MODULES
...
Siteglide Modules
Blog

Browse By Category

7min
this navigation option can be used in combination with other navigation options introduction this article will show how to include this navigation option when including the blog the default layouts with explanation how to give the user feedback on the type of results they are seeing add "use adv search" parameter to include for blog list view the "use adv search" parameter is needed to allow filtering from the url to apply to your blog posts, this can be added to the include for blog list like so {% include 'module' id '3' layout 'default' per page '20' show pagination 'true' sort type 'created at' sort order 'desc' use adv search 'true' %} to include this option include the following liquid to dynamically get a list of available blog categories for the user to select {% include 'modules/siteglide system/get/get categories' categories layout 'default/categories' categories layout type 'sidebar' %} the parameters refers to layout which will be used to display the category links \<code>categories layout\</code>should be the root layout folder where your blog layout is contained the category layout type is the sub folder where the wrapper and item files are stored for filtering the blog list by category the category layout type exists because some blog layouts may have a different partial layout for categories within a blog preview, footer or sidebar default layout examples with explanation wrapper liquid categories {% include 'modules/siteglide system/get/get items', item layout 'item' %} item liquid {{this properties name}} the link should be the slug of your blog list view followed by ?category={{this id}} siteglide will be able to read the category id from the url and populate the list view on refresh in this example we use the context object to automatically get the slug of the current blog page user feedback you may wish to give the user some feedback about the current filter/ search terms that are applied on the blog list page for categories, you can use \<code>context exports\</code> object to get the name of the category you are filtering by {% if context params category %} posts about {{context exports categories data\[context params category] name}} {% endif %}