#6.1 Create content
In this lesson, you will populate the e-commerce project with content. The fields, dropdowns, references, and components in the content editor are a direct result of the schema built in lessons 1 through 5. If anything looks unexpected, it is worth returning to the relevant schema lesson to verify the configuration.
The lesson is structured in stages because some content depends on other content existing first. Products cannot have related products until other products exist. Landing pages cannot reference blog posts or categories until those entries are published. Follow the sections in order.
#Assets
The cloned project already contains product images. You need to add alt text and a caption to the headband image to get started.
-
In your Hygraph project, click Assets.
-
Type
headbandin the search filter. -
Open the first result to edit the asset.
-
Fill in the following fields and click Save & Publish:
Field Input Alt text Cotton headband Caption A soft white cotton headband -
Click the back arrow next to Edit Asset at the top left to return to the assets table.
-
Click the X next to the search filter to reset it.
For alt text and caption data for all remaining assets, see Create content — additional practice. Adding this data is optional and does not affect the frontend connection.
#Product categories
The Product category model was created in lesson 1.2 and connected to the Product model through a many-to-many reference in lesson 2.1. Each category entry created here can later be assigned to multiple products, and each product can belong to multiple categories.
No product entries exist yet, so you will create the categories first and add product assignments later.
-
Go to Content, and under Default Views, click Product category.
-
Click + Add entry.
-
Create the following entry and click Save & Publish:
Field Input Category name Clothes Slug clothes Description You will find clothes here
Repeat the process for each of the following categories:
| Category name | Slug | Description |
|---|---|---|
| Shoes | shoes | You will find shoes here |
| Sportswear | sportswear | You will find sportswear here |
| Urban | urban | You will find urban-style items here |
| New arrival | new-arrival | You will find our latest arrivals here |
| Decor | decor | You will find decor items here |
| Accessories | accessories | You will find accessories here |
Some categories overlap by design. Because the reference between products and categories is many-to-many, one product can belong to both New arrival and Sportswear at the same time.
Your Product categories view should now look like this:
Product categories in the content editor with entries
#Seller information
The Seller information model holds business details that the landing page references. Create a single entry.
-
Go to Content, and under Default Views, click Seller information.
-
Click + Add entry.
-
Fill in the following fields and click Save & Publish:
Field Input Business name My business Slug my-business Business logo Click Add business logo, select the Hygraph logo from your assets, and click the relation icon in the first column to add it Business description This is a description of my business
Your Seller information view should look like this:
Seller information content editor view with entry
#Products
Product entries are created in two steps. In this step, you will create the basic product listing. Related products are added in the next step, once all product entries exist.
-
Go to Content, and under Default Views, click Product.
-
Click + Add entry.
Add product content entry -
Create the first entry using the following information:
Field Input Product name Black leather shoes Product slug black-leather-shoes Product category Click Add existing Product categories and select Shoes and New arrival Product image Click Add Product images, type black leather shoesin the search filter, and click Add selected imagesProduct description These black leather shoes seamlessly blend sophistication with durability, making them a versatile choice for both formal occasions and everyday wear. The sleek design and high-quality leather ensure a timeless appeal that complements any outfit. Product variant Click Add component, select Shoes, then set Size to Size_40and Color toBlackProduct price 170 Product variantis the modular component field built in lesson 4.1. Clicking Add component presents the four product type options —Clothing,Shoes,Accessories,Decor. SelectingShoesreveals only the shoe size and color fields, not the clothing size fields. This is the modular component working as configured. -
Click Save & Publish.
Product content entry
Now create the remaining product entries using the following information:
Blue running shoes
| Field | Input |
|---|---|
| Product name | Blue running shoes |
| Product slug | blue-running-shoes |
| Product category | Select Sportswear and Shoes |
| Product image | Select images with file name blue running shoes |
| Product description | These blue running shoes offer both form and function, providing exceptional support and style for your active pursuits. The breathable material and cushioned sole ensure a comfortable experience mile after mile. |
| Product variant | Select Shoes, then Size Size_42 and Color Blue |
| Product price | 130 |
Plaid shirt
| Field | Input |
|---|---|
| Product name | Plaid shirt |
| Product slug | plaid-shirt |
| Product category | Select New arrival, Urban, and Clothes |
| Product image | Select images with file name blue plaid shirt |
| Product description | This plaid shirt exudes a timeless charm, perfect for a casual day out or a relaxed evening gathering. The classic checkered pattern and comfortable fit make it a wardrobe staple for effortless style. |
| Product variant | Select Clothing, then Size XL and Color Blue |
| Product price | 60 |
Necklace
| Field | Input |
|---|---|
| Product name | Necklace |
| Product slug | necklace |
| Product category | Select Accessories |
| Product image | Select images with file name necklace |
| Product description | This white necklace is crafted from parts of seashells, evoking a relaxed, beachy vibe. Perfect for those looking to add a touch of the sea to their daily style. |
| Product variant | Select Accessories, then Color White |
| Product price | 12 |
Headband
| Field | Input |
|---|---|
| Product name | Headband |
| Product slug | headband |
| Product category | Select Accessories |
| Product image | Select images with file name headband |
| Product description | This white cotton headband provides an elegant and sophisticated touch to your hairstyle. Perfect for completing your look with a blend of fashion and comfort. |
| Product variant | Select Accessories, then Color White |
| Product price | 9 |
For adding more product entries, see Create content — additional practice. Adding these is optional but some API Playground query exercises in lesson 7.1 reference them.
#Related products
Now that you've created all product entries, you can add related products to each one.
-
Open the Headband entry to edit it.
-
Scroll to the Related Products component and click + Add Related Products.
The Title field is read-only and displays
Related Products. This is because you set the field to read-only with an initial value when building the component in lesson 4.1. So, every instance of this component shows the same heading. -
Click Add existing products and select: black leather shoes, necklace, blue running shoes, and plaid shirt.
-
Click Add selected products, then click Save & Publish.
Component with related products
Repeat for the remaining product entries:
| Product entry | Related products |
|---|---|
| Blue running shoes | black leather shoes, necklace, headband, plaid shirt |
| Black leather shoes | blue running shoes, necklace, headband, plaid shirt |
| Necklace | black leather shoes, blue running shoes, headband, plaid shirt |
| Plaid shirt | black leather shoes, necklace, headband, blue running shoes |
For related product assignments for the additional practice entries, see Create content — additional practice.
#Blog post
Create a blog post entry to use on the landing page.
-
Go to Content, and under Default Views, click Blog post.
-
Click + Add entry and fill in the following:
Field Input Title Our new leather shoes Slug Auto-completes from the title. Leave as is. Body Type Take a look at this awesome new arrival. Then click Embed, select Block, choose the Product model from the dropdown, click Select model, and select the Black leather shoes entry. -
Click Save & Publish.
Your blog post entry should look like this:
Blog post complete entry
#Landing pages
You will create two landing pages: a homepage and a Summer Campaign page. The homepage could not have been created earlier because it references seller information, blog posts, and products that needed to exist first.
#Homepage
-
Go to Content, and under Default Views, click Landing page.
-
Click + Add entry and fill in the following:
Field Input Landing page title Home Link /Blog posts Leave empty for now Product categories Leave empty for now Seller information Add the seller information entry created earlier Stripes Click + Add component and add a Call to Actionand aProduct Gridusing the information belowCall to Action:
Field Input Heading Main Headline for the page Body We provide amazing products from outerwear, shoes, home goods, and more! Be sure to check out all the amazing products. Image Add the Hygraph Logo asset Button Click + Add Button, enter Shop Nowin the Text field andhttps://google.comin the URL fieldProduct Grid:
Field Input Headline Picks of the month Products Add relations to: blue running shoes, black leather shoes, necklace, headband, plaid shirt -
Click Save & Publish.
Your homepage entry should look like this:
#Summer Campaign
-
Go to Content, and under Default Views, click Landing page.
-
Click + Add entry and fill in the following:
Field Input Landing page title Summer Campaign Link summer-campaign Blog posts Leave empty for now Product categories Leave empty for now Seller information Add the seller information entry created earlier Stripes Click + Add component and add a Call to Actionand aProduct Gridusing the information belowCall to Action:
Field Input Heading Get ready for summer with these amazing deals Body The Summer Sale is in full swing! See the amazing summer deals we have listed below! Image Leave empty Button Leave empty Product Grid:
Field Input Headline Summer wear Products Add relations to: blue running shoes, black leather shoes, necklace, headband, plaid shirt -
Click Save & Publish.
#Navigation
The Navigation model uses the Link component built in lesson 4.1. Each Nav Link entry in the navigation maps to one link in the frontend navigation bar.
-
Go to Content, and under Default Views, click Navigation.
-
Click + Add entry and fill in the following:
Field Input Nav ID main -
Click + Add Link to add the first Nav Link component and fill in:
Field Input Display Text Clothes Page Leave empty External URL /category/clothes -
Click + Add another Link and repeat for each of the following:
Shoes
Field Input Display Text Shoes Page Leave empty External URL /category/shoesAccessories
Field Input Display Text Accessories Page Leave empty External URL /category/accessoriesDecor
Field Input Display Text Decor Page Leave empty External URL /category/decorSummer Campaign
Field Input Display Text Summer Campaign Page Click Add existing document and select the Summer Campaign landing page External URL Leave empty -
Click Save & Publish.
The navigation entry now contains all the links the frontend needs. These will be visible when the storefront is connected in lesson 8.
#What's next
Lesson 6.2 - Localize contentOr, go to the Tutorial overview for the full lesson list.