Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
The Article will show you how to adapt your Liquid Syntax and Blog Layouts to allow the User to Search for Posts by Keyword
You can also allow the User to search for Blog Posts by keyword. This requires a slightly different Liquid parameter from the other navigation methods, but you can use both parameters if you choose.
Although all other Blog Navigation options require you to set the use_adv_search: 'true'
Liquid parameter, keyword search requires the use_search: 'true'
parameter.
This code can be included in one of your Blog Navigation Layouts. Keyword Search will be activated if you've set the Liquid parameter above and the JavaScript below sets the keyword parameter in the URL.
If you use one of our Site Builder templates these steps will already be done for you and all you need to do is customise the Blog. This is our recommended route: Quickstart: SiteBuilder
Go to the Modules tab under the Site you want to work on in Portal and click install on Blog and Authors. They may already be installed if you're using a Template or existing site:
More on Installing and Managing Modules:
Go to the Module page within the Site and either edit an existing item or create a new one:
Give it a name and fill in other fields you might want to use:
You then need to output the Blog on the site. You'll likely want to create a Page called Blog:
You then output it on the page using Toolbox (or via CLI):
Your Blog will work out of the box but Siteglide is all about flexibility and recognising each project is different. You have total control to customise the Layouts and how the Blog works. We recommend looking at the SiteBuilder Blog Layouts as a starting point as there might be existing Layouts that can save you a lot of time.
This Navigation Option can be used in combination with other Navigation Options.
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.
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 the following liquid to dynamically get a list of available Blog Categories for the User to select:
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.
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.
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:
See general module folder strucutre for folder structure in common with all modules:
Blog module layouts may contain optional extra files for components like author lists, categories etc.
Replace "custom_example" with the name of your own custom layout. You can add as many of these as you like to the module_3 folder.
There is also a form directory for storing form layouts for front-end module/ author item submission.
Combining the Blog and Author Modules allows you to filter the Blog posts by a specific Author's posts.
This article explains:
How to include the Browse by Author Option when including a Blog List
Default Layout Examples
How to give feedback to the User about their results e.g. in the screenshot "Posts by Regina Alexander"
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 the following liquid to dynamically get a list of available Blog Authors for the User to select.
The author_field
will be module_field_3_4
if you are using Siteglide's Authors Module. The layouts are structured in the same way as Category Layouts in the previous section.
To filter the Blog List View, you need a link to the Blog List View slug, followed by "?module_field_3_4={{this.id}}"
. Siteglide will be able to read the URL and filter the list.
To make it easier to give feedback to the User, you can optionally include the Author's name in the url:
On the List view, you can then include the following liquid to read the URL and decode the Author name you are currently filtering by:
This reference gives you a quick guide to all the code you can use with the Blog, but some features are available to all Modules, see more:
The Blog uses standard module fields as well as it's own core fields:
As always, to use filtering on an included module layout, add the use_adv_search
parameter. To allow searching, add use_search
. These settings instruct this component to watch the URL for changes in URL parameters and will adjust results accordingly when the URL changes; forms, anchors or JS (for example, the SiteBuilder Live Updates API) can be used to change the URL and apply these.
(Requires use_adv_search
)
Include the Archive Layout (included in the default layout, or make your own) to list all available years or months containing blog posts.
Inside an archive layout, you have access to the following variables which can be looped over to find the months in which at least one blog post was published: blog_archive_years
and months_by_year
To apply filters, the URL must be given the following parameters:
A combination of range_gt
, range_gte
, range_lt
, range_lte
to set the date range to "range greater than", "range greater than or equal to" etc., in the format: %Y-%m-%d.
range_type
- an optional convention, you can set this to e.g. "between" or "month" so that you can interpret the URL accordingly when you arrive.
range_field
- is used in Events module, but not needed here. Default is to use release date for range field
(Requires use_adv_search
)
Include the following liquid to dynamically get a list of available Blog Categories for the User to select:
To apply filters, the URL must be given the following parameters:
category - to be given the value of one or more category IDs to filter by, comma separated.
(Requires use_adv_search
)
To apply filters, the URL must be given the following parameters:
module_field_3_4
- set to a valid Author's module item ID
author_name
- an optional convention making it easier to display this when arriving at the list.
Link to the page with a keyword
parameter in the URL to perform a search. (Requires use_search
)
Authors uses standard module fields as well as it's own core fields:
Field Name | Liquid Tag | Description |
Title | {{ this['Title'] }} | title of the Blog Post |
Subtitle | {{ this['Subtitle'] }} | subtitle of the Blog Post |
Description | {{ this['Description'] }} | list description of the Blog Post |
Author - Syntax type 1 (Requires Authors Module) | data source of author. Parameters: author_layout: path to the folder containing author layouts. author_layout_type: name of author layout folder (containing wrapper and item files). author_id: Unique ID of the author for this item- can be dynamically passed in with |
Author - Syntax type 2 (Requires Authors Module) - The benefit of this syntax is that it should be more consistent with how other Modules are outputted on the Page | data source of author. Parameters: layout path to the folder containing author layouts within the blog module. type- name of the layout folder containing wrapper and item Liquid layout files. datasource - should be set to true to indicate that this module is a sub-module placed inside another module Layout. item_ids - indicates the unique ids of the Author items you want to display- can be dynamically passed in with |
Main Image | {{ this['Main Image'] }} | main image of the Blog Post |
Main Image Alt | {{ this['Main Image Alt'] }} | main image alt tag of the Blog Post |
List Image | {{ this['List Image'] }} | list image of the Blog Post |
List Image Alt | {{ this['List Image Alt'] }} | list image alt tag of the Blog Post |
Content | {{ this['Content'] }} | main content of the Blog Post |
Category Array | {{ this.category_array }} | outputs comma-separated list of IDs for Categories this item belongs to. |
Field Name | Liquid Tag | Description |
Title | {{ this['Title'] }} | name of the Author |
Subtitle | {{ this['Subtitle'] }} | Job title or other short text about the Author |
Description | {{ this['Description'] }} | Description of the Author |
Image | {{ this['Image'] | asset_url }} | Image of the Author |
Image Alt | {{ this['Image Alt'] }} | Image alt of the Author image |
Linkedin URL | {{ this['LinkedIn URL'] }} | Linkedin profile URL of the Author |
Facebook URL | {{ this['Facebook URL'] }} | Facebook profile URL of the Author |
Twitter URL | {{ this['Twitter URL'] }} | Twitter profile URL of the Author |
Instagram URL | {{ this['Instagram URL'] }} | Instagram profile URL of the Author |
Pinterest URL | {{ this['Pinterest URL'] }} | Pinterest profile URL of the Author |