Hygraph
Docs

#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.

Add alt text and caption to assets
  1. In your Hygraph project, click Assets.

  2. Type headband in the search filter.

  3. Open the first result to edit the asset.

  4. Fill in the following fields and click Save & Publish:

    FieldInput
    Alt textCotton headband
    CaptionA soft white cotton headband
  5. Click the back arrow next to Edit Asset at the top left to return to the assets table.

  6. Click the X next to the search filter to reset it.

#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.

  1. Go to Content, and under Default Views, click Product category.

  2. Click + Add entry.

  3. Create the following entry and click Save & Publish:

    FieldInput
    Category nameClothes
    Slugclothes
    DescriptionYou will find clothes here

Repeat the process for each of the following categories:

Category nameSlugDescription
ShoesshoesYou will find shoes here
SportswearsportswearYou will find sportswear here
UrbanurbanYou will find urban-style items here
New arrivalnew-arrivalYou will find our latest arrivals here
DecordecorYou will find decor items here
AccessoriesaccessoriesYou 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 entriesProduct 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.

  1. Go to Content, and under Default Views, click Seller information.

  2. Click + Add entry.

  3. Fill in the following fields and click Save & Publish:

    FieldInput
    Business nameMy business
    Slugmy-business
    Business logoClick Add business logo, select the Hygraph logo from your assets, and click the relation icon in the first column to add it
    Business descriptionThis is a description of my business

Your Seller information view should look like this:

Seller information content editor view with entrySeller 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.

  1. Go to Content, and under Default Views, click Product.

  2. Click + Add entry.

    Add product content entryAdd product content entry

  3. Create the first entry using the following information:

    FieldInput
    Product nameBlack leather shoes
    Product slugblack-leather-shoes
    Product categoryClick Add existing Product categories and select Shoes and New arrival
    Product imageClick Add Product images, type black leather shoes in the search filter, and click Add selected images
    Product descriptionThese 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 variantClick Add component, select Shoes, then set Size to Size_40 and Color to Black
    Product price170

    Product variant is the modular component field built in lesson 4.1. Clicking Add component presents the four product type options — Clothing, Shoes, Accessories, Decor. Selecting Shoes reveals only the shoe size and color fields, not the clothing size fields. This is the modular component working as configured.

  4. Click Save & Publish.

Product content entryProduct content entry

Now create the remaining product entries using the following information:

Blue running shoes

FieldInput
Product nameBlue running shoes
Product slugblue-running-shoes
Product categorySelect Sportswear and Shoes
Product imageSelect images with file name blue running shoes
Product descriptionThese 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 variantSelect Shoes, then Size Size_42 and Color Blue
Product price130

Plaid shirt

FieldInput
Product namePlaid shirt
Product slugplaid-shirt
Product categorySelect New arrival, Urban, and Clothes
Product imageSelect images with file name blue plaid shirt
Product descriptionThis 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 variantSelect Clothing, then Size XL and Color Blue
Product price60

Necklace

FieldInput
Product nameNecklace
Product slugnecklace
Product categorySelect Accessories
Product imageSelect images with file name necklace
Product descriptionThis 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 variantSelect Accessories, then Color White
Product price12

Headband

FieldInput
Product nameHeadband
Product slugheadband
Product categorySelect Accessories
Product imageSelect images with file name headband
Product descriptionThis 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 variantSelect Accessories, then Color White
Product price9

Now that you've created all product entries, you can add related products to each one.

  1. Open the Headband entry to edit it.

  2. 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.

  3. Click Add existing products and select: black leather shoes, necklace, blue running shoes, and plaid shirt.

  4. Click Add selected products, then click Save & Publish.

Component with related productsComponent with related products

Repeat for the remaining product entries:

Product entryRelated products
Blue running shoesblack leather shoes, necklace, headband, plaid shirt
Black leather shoesblue running shoes, necklace, headband, plaid shirt
Necklaceblack leather shoes, blue running shoes, headband, plaid shirt
Plaid shirtblack leather shoes, necklace, headband, blue running shoes

#Blog post

Create a blog post entry to use on the landing page.

  1. Go to Content, and under Default Views, click Blog post.

  2. Click + Add entry and fill in the following:

    FieldInput
    TitleOur new leather shoes
    SlugAuto-completes from the title. Leave as is.
    BodyType 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.
  3. Click Save & Publish.

Your blog post entry should look like this:

Blog post complete entryBlog 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

  1. Go to Content, and under Default Views, click Landing page.

  2. Click + Add entry and fill in the following:

    FieldInput
    Landing page titleHome
    Link/
    Blog postsLeave empty for now
    Product categoriesLeave empty for now
    Seller informationAdd the seller information entry created earlier
    StripesClick + Add component and add a Call to Action and a Product Grid using the information below

    Call to Action:

    FieldInput
    HeadingMain Headline for the page
    BodyWe provide amazing products from outerwear, shoes, home goods, and more! Be sure to check out all the amazing products.
    ImageAdd the Hygraph Logo asset
    ButtonClick + Add Button, enter Shop Now in the Text field and https://google.com in the URL field

    Product Grid:

    FieldInput
    HeadlinePicks of the month
    ProductsAdd relations to: blue running shoes, black leather shoes, necklace, headband, plaid shirt
  3. Click Save & Publish.

Your homepage entry should look like this:

Homepage complete entry

#Summer Campaign

  1. Go to Content, and under Default Views, click Landing page.

  2. Click + Add entry and fill in the following:

    FieldInput
    Landing page titleSummer Campaign
    Linksummer-campaign
    Blog postsLeave empty for now
    Product categoriesLeave empty for now
    Seller informationAdd the seller information entry created earlier
    StripesClick + Add component and add a Call to Action and a Product Grid using the information below

    Call to Action:

    FieldInput
    HeadingGet ready for summer with these amazing deals
    BodyThe Summer Sale is in full swing! See the amazing summer deals we have listed below!
    ImageLeave empty
    ButtonLeave empty

    Product Grid:

    FieldInput
    HeadlineSummer wear
    ProductsAdd relations to: blue running shoes, black leather shoes, necklace, headband, plaid shirt
  3. Click Save & Publish.

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.

  1. Go to Content, and under Default Views, click Navigation.

  2. Click + Add entry and fill in the following:

    FieldInput
    Nav IDmain
  3. Click + Add Link to add the first Nav Link component and fill in:

    FieldInput
    Display TextClothes
    PageLeave empty
    External URL/category/clothes
  4. Click + Add another Link and repeat for each of the following:

    Shoes

    FieldInput
    Display TextShoes
    PageLeave empty
    External URL/category/shoes

    Accessories

    FieldInput
    Display TextAccessories
    PageLeave empty
    External URL/category/accessories

    Decor

    FieldInput
    Display TextDecor
    PageLeave empty
    External URL/category/decor

    Summer Campaign

    FieldInput
    Display TextSummer Campaign
    PageClick Add existing document and select the Summer Campaign landing page
    External URLLeave empty
  5. 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 content

Or, go to the Tutorial overview for the full lesson list.