Choose where posts are read
v0.0.3
A post is read at the address its site's post page makes of it. By default that is /blog/<post>. You can put the post's first category in the address, or write a path of your own, such as the ones a WordPress site used. When a save moves an address, the old one keeps working. This guide changes where posts are read, shows what a path can hold, and explains the redirects the Mishka Blog writes for you.
Before you begin
- Set the blog up on your site. The sample pages are the pages this guide moves.
- To change the Post address setting, hold
admin:dashboard:setting. The setting moves the post page as the admin who saves it, so that admin also needsadmin:dashboard:runtime:page. An admin without it changes the setting and nothing else. - To edit a page's path yourself, hold
admin:dashboard:runtime:page.
Put the category in the address
- Open Settings and the Blog tab, at
/admin/dashboard/settings?tab=blog. Find Post address under Addresses. - Choose
/blog/category/post, the post's first category. The default is/blog/post. - Save the setting.
Saving gives the site a post page at /:lang/blog/:category/:slug. If the site has that page, it is made active. Otherwise the blog writes it from its post page. The new page has a priority one above the slug page, so it is the page every link and canonical address names.
- The slug page stays. It serves a post filed under no category.
- A post filed under a category and asked for at
/blog/<post>is sent to its own address with a 301. - Choosing
/blog/postagain makes the category page inactive.
A post filed under two categories is read under either one. Its canonical address is the one with its first category, and the other address is still its page.
Write your own post path
- In the admin, open Pages and click the pencil icon, Edit, on the row of the page that shows each post. On the sample pages it is named Blog post. The dialog opens on its Configuration tab, where This page shows each is set to Post.
- Change Path to one of the shapes below, and save.
A post's address is filled from the post. Every link the blog builds to a post follows the path: the blocks, the head, the language dropdown, the sitemap and the feeds.
| Capture | Filled with |
|---|---|
:lang | The post's language. |
:slug | The post's slug. |
:year, :monthnum, :day | The post's publish date in UTC. The month and the day have two digits. |
:post_id | The post's number. |
:category | The slug of the first category the post is filed under, as one segment. |
A site that keeps the addresses it had on WordPress can give its post page any of these paths, with or without a /:lang or an /index.php prefix:
/:slug/:year/:monthnum/:slug/:year/:monthnum/:day/:slug/:category/:slug/archives/:post_id
The category, tag and blogger pages' paths can be whatever the site used.
- A date, a number or a category in the address must be the post's. A post asked for under a category it is not filed in, or by a date or number that is not its own, is sent to its own address with a 301.
:categoryis one segment, the category's own slug. WordPress's whole chain,/parent/child/slug, is not an address here.- A post that has no value for a capture has no address at that page. A post filed under no category has none at
/:category/:slug, and an unpublished post has no date. Such a post is left out of the sitemap and the feeds. - A post's number is its
/archives/:post_idaddress. A new post gets the next free number, and a create or update may name its own, which is how an import keeps a WordPress post's id.
List a nested category by its chain
On a category page whose path ends in *slug, such as /:lang/category/*slug, a category under another is listed, counted and paged at its whole chain, /category/design/accessibility. The blocks blog-post-list, blog-featured-posts and blog-post-search read a collection given as a chain by its last segment, and the category links of the other blocks use the chain. The category alone, /category/accessibility, still answers, with the chain as its canonical address. Update the blog components from the check window so the blocks know the chain. See Set up the blog on a site.
How old addresses keep working
When a save moves a post, a category, a tag, a blogger or a team, the blog writes a 301 from its old address to the new one. The rule is a site redirect rule, listed in Redirects in the admin, where you can edit or delete it. A blog editor needs no redirect permission for this.
A save moves an address when it changes the slug, the language, the publish date, the number, the parent category or, on a post page whose path names :category, the first category. A blogger and a team are one record in every language, so they move at the address of each language the site publishes in.
| Case | What the blog does |
|---|---|
| A draft, or a post the save unpublishes | Writes nothing. |
| A redirect already points at the old address | Points it at the new address, so there are no chains. |
| A rule sits at the new address | Archives it, because it would hide the record and loop back. |
| An active rule is already at the old address | Leaves it. A rule you wrote is never overwritten. |
| An inactive rule is at the old address | Points it at the new address and switches it on. |
| A category's slug changes | Writes the category's own rule only. Its posts and children are not followed. |
When an address clashes or is unknown
- A post whose address would be a page the site already serves, such as
/abouton a site whose post page is/:slug, is refused with This post's address, /about, is already a page of this site. - An address that names a post, category, tag, blogger or team the site does not have answers the site's 404. A real category or tag with nothing published under it is still its own empty page. A post locked to a permission the reader does not hold answers with its lock.