CMS: Displaying Your Blog Categories Using Datasets

5 min read
With the Wix Blog, you get a ready-made blog feed. However, if you want to show blog posts from a specific category, enjoy more customization, and display your blog posts in chronological order, you can do so using a repeater or table.
Important:
When you display blog categories with repeaters or tables, your site visitors cannot comment or 'like' blog categories.

Step 1 | Add a dataset and connect it to your blog's categories

In this step, we add a dataset that will host information about categories from your blog collection. This can be referenced in another step to filter only posts in specific categories.
New datasets experience:
In Wix Studio, we've moved datasets to the Inspector panel on the right to make them easier for you to use. Learn more about the new datasets experience in Wix Studio

To add a dataset to the page (and connect it to the blog's categories):

  1. Click CMS  on the left side of the Editor.
  2. Click Add Content Elements then click the Add icon  next to Dataset.  


  3. Click the newly added dataset.
  4. Click Settings.
  5. Select Categories from the Connect a collection drop-down.

Step 2 | Add a repeater or table to your page

A repeater displays content using a layout that you can change. For example, you can add another text box, image, or button. A table also displays your content, but it uses layouts that you cannot change.

To add a repeater or table to your page:

  1. Click Add  on the left side of the Editor.
  2. Click List.
  3. Drag a repeater or table onto your page.

Step 3 | Add another dataset and connect it to your blog posts

Repeaters and tables can show items from collections when they are linked via a dataset. In this step, we add a dataset to associate a repeater or table with blog posts.

To add another dataset to the page (and connect it to your blog posts):

  1. Click CMS  on the left side of the Editor.
  2. Click Add Content Elements then click the Add icon  next to Dataset.
     
  3. Click the newly added dataset.
  4. Click Settings.
  5. Select Posts from the Connect a collection drop-down.

Step 4 | Connect your repeater or table to the Posts dataset

In order for your repeater or table to show your blog categories, we connect it to one of the datasets already on the page.

To connect your repeater or table to the Posts dataset:

  1. Click your repeater or table in your Editor.
  2. Click the Connect to Data icon .
  3. From the Connect a dataset drop-down, select the Posts dataset.
  4. Link each of the components of your repeater or table to the appropriate fields in the collection. Click the arrow next to each of the components in the repeater or table (text, image etc.) and connect each one to the desired fields in the collection.
    Note: You can also link an image or button to Post Page URL (URL). This brings the visitor to that blog post when clicked.


Step 5 | Set up your filters

To display only the blog posts from a specific category, set up a filter in each of the datasets on yout page.

To set up your filters:

  1. Click the Posts dataset.
  2. Click Settings.
  3. Click + Add Filter.
  4. Click the Field drop-down and select Categories (Categories).
  5. Select Another dataset under Value source.
  6. Select Categories dataset under Dataset.
  7. Click Add Filter.


  8. Click the Categories dataset.
  9. Click Settings.
  10. Click + Add Filter.
  11. Click the Field drop-down and select Label (Text).
  12. Type the name of the category you want to show in the Value field.
  13. Click Add Filter.


  14. Click Save.
  15. Click Preview.

What’s next?
  • You can control the number of posts being shown using the repeater’s Dataset Settings or the Table Layout.


  • Add a pagination or a load more button to display more blog posts.
  • Adjust the order of your post to show a specific sequence.

Did this help?

|