Posts Filter is a FilterQ expression to filter posts. These filtered posts will be sent to the template as the _posts
variable. It is only used in listing pages like index, tag, author. Matched params ({slug}
) can be used in this expression.
Routes are used to configure how specific requests are handled. A route matches the request path and determines what output to send back to the user. For example, if the request path is /tag/my-tag
, route determines that it should render tag.twig
and send response back to the user.
Route Settings: Console → Settings → Routes
A new blog will have these 5 default routes.
post
/{slug}
page
/{slug}
index
/
tag
/tag/{slug}
tag.slug = {slug}
author
/author/{slug}
author.slug = {slug}
Posts Filter is a FilterQ expression to filter posts. These filtered posts will be sent to the template as the _posts
variable. It is only used in listing pages like index, tag, author. Matched params ({slug}
) can be used in this expression.
In addition to those default routes, there are some special, non-customizable routes.
/styles.css
/assets/{file_name}
/media/{file_name}
/p/{hash}
/robots.txt
/sitemap.xml
, /sitemap-pages.xml
, /sitemap-posts-x.xml
You can change the match value of post
and page
routes to change post/page permalinks. By default, it looks like /{slug}
. You may change it to a different structure which may have date, tag, and/or author name. Here are some examples.
/{year}/{month}/{day}/{slug}
/{tag}/{slug}
/{author}/{slug}
Note that {slug}
is always required. The following placeholders are supported.
Basic placeholders:
{slug}
{tag}
{author}
Please note that if you use {tag}
(or {author}
) in the post/page URL, all post should have at least one tag (or author). Otherwise, the post/page URL will show 404 error.
Time-based placeholders:
{year}
2022
{year_short}
99
or 22
{month}
01
or 12
{month_number}
1
to 12
{month_short}
jan
to dec
{month_long}
january
to december
{day}
01
to 31
{day_number}
1
to 31
{day_year}
1
to 365
{day_week}
mon
to sun
{day_week_long}
monday
to sunday
{day_week_number}
1
to 7
{hour}
00
to 23
{minute}
00
to 59
{second}
00
to 59
{unix}
1448406000
Similar to post
and page
, routes
, other default routes (index
, tag
, author
, and search
) routes are customizable to some extent. Here are some ideas:
/author/{slug}
→/creator/{slug}
/tag/{slug}
→/category/{slug}
/
→/blog
Please note that you (or theme developers) can also add custom routes by adding route-{route}
.twig files to template files. See here from more details.
In addition to the default 6 routes, you can add your own routes. Some examples use cases are:
Please note that you (or theme developers) can also add custom routes by adding route-{route}
.twig files to template files. See here from more details.
Usually, route conflicts can happen when two or more routes has the same match value. In Hyvor Blogs, post
and page
routes can have the same match values. (You can see, the default values of those two routes are the same: /{slug}
). However, other routes match cannot have duplicate match values.
These suffixes are supported:
/feed
- For the atom feed (posts_filter
should be set)/page/{page_number}
- For paginationMatches can be prefixed with a language code. See languages for setting up multiple languages on your blog.
We usually call a website "a blog" when it has posts and the home page lists all of them. That is the default behavior of Hyvor Blogs. Even out of its purpose, you can use Hyvor Blogs to create a general website. For example, you can create a landing page for the homepage, and have your blog in the /blog
subdirectory.
By default, your blog has one post collection, and all posts will be listed the index page. What if you want to have to separate collections, for example, blog posts and podcast episodes in the blog? You can use routes and tags to achieve this.
podcast
tag to the all podcast posts.index
(/
) route and its template (index.twig
) to show an overview of blog posts and podcast episodes. To do this, you will need to update index.twig
and use our Data API to fetch posts separately./blog
-> to list blog posts (using the filter tag.slug != podcast
)/podcast
-> to list podcast episodes (using the filter tag.slug = podcast
)