Purely hierarchical URL scheme for blog on level below root with Core or Plugin
-
My intended blog URL scheme: Strictly Hierarchical Blog at
/blog/
Goal: Everything related to the blog is at
/blog/
and below, in a strictly hierarchical fashion:/ # The Static Home Page integrating links to pages, blog index, particular blog category indices. /blog/ # The Blog Index Page /blog/ux/ # A Blog Category Index Page /blog/ux/feature-proposal/ # A Blog Sub Category Index Page /blog/hints/ # Another Blog Category Index Page /blog/categories/ # Optional: The Categories Page. Implementation: Custom slug where custom page/template with Categories block. # All blogposts sorted beyond that hierarchy: # /blog/<main-category>/<sub-category>/<blog-title> /blog/ux/feature-proposal/hotapp-duplicate-file-dialog/ /blog/ux/feature-proposal/hotapp-support-negation-operator/ /blog/hints/hint-two/ /blog/hints/hint-one/ /blog/uncategorized/hello-world/
In a filesystem analogy this can be imagined as:
- Categories and sub-categories as folders and sub-folders
- Posts sorted therein.
- Categories is a folder which contains links to all category folders.
- This is a redundancy/workaround because you cannot go to top, because there is the static homepage.
- Ideally the static homepage anyways integrates links to the most important / all categories.
Failed to achieve this as a WP core only solution and also with your plugin:
- Is this setup possible with WordPress Core only? → ? Setup 3 failed!
- Or with a plugin? → ? Setup 3b with your plugin No Category Base (WPML) failed too!
- Or another tweak? → Hints appreciated! ??
Showing all test setups and their outcome which I did to verify/falsify my suspicions/assumptions.
Environment
WordPress 6.4.3 — Vanilla setup on wpsandbox.org
Settings → Permalink: Setup variations that I tried
Setup 1: Standard Category Base + Posts under Category
- Custom Structure:
/%category%/%postname%/
- Category base:
- Tag base:
- ? Resulting URLs and their status code when queried:
HTTP URL 200 /blog/ # Default Blog Index slug in WordPress 200 /reserved/ # Test page for testing. 200 /category/ux/ 200 /category/ux/feature-proposal/ 200 /category/hints/ 200 /ux/feature-proposal/hotapp-duplicate-file-dialog/ 200 /ux/feature-proposal/hotapp-support-negation-operator/ 200 /hints/hint-two/ 200 /hints/hint-one/ 200 /uncategorized/hello-world/
Setup 2: Blog as Category Base + Posts under Category
- Custom Structure:
/%category%/%postname%/
- Category base:
blog
- Tag base:
- ? Resulting URLs and their status code when queried:
HTTP URL 200 /blog/ # Blog index indeed. 200 /reserved/ # Test page indeed. 200 /blog/ux/ 200 /blog/ux/feature-proposal/ 200 /blog/hints/ 200 /ux/feature-proposal/hotapp-duplicate-file-dialog/ 200 /ux/feature-proposal/hotapp-support-negation-operator/ 200 /hints/hint-two/ 200 /hints/hint-one/ 200 /uncategorized/hello-world/
Setup 3: Strictly Hierarchical Blog at /blog with WP Core only
- Custom Structure:
/blog/%category%/%postname%/
- Category base:
blog
- Tag base:
- Resulting URLs and their status code when queried:
- ? All blogpost URLs return HTTP 404 Not Found.
- ? Custom Structure without leading slash fails too.
HTTP URL 200 /blog/ # Blog index indeed. 200 /reserved/ # Test page indeed. 200 /blog/ux/ 200 /blog/ux/feature-proposal/ 200 /blog/hints/ 404 /blog/ux/feature-proposal/hotapp-duplicate-file-dialog/ 404 /blog/ux/feature-proposal/hotapp-support-negation-operator/ 404 /blog/hints/hint-two/ 404 /blog/hints/hint-one/ 404 /blog/uncategorized/hello-world/
Setup 4: Unreserved Slug as Category Base + Posts Hierarchical
- Custom Structure:
/something/%category%/%postname%/
- Category base:
blog
- Tag base:
- Resulting URLs and their status code when queried:
- ? Custom structure prefixed with arbitrary available slug and all blogpost URLs work fine!
- ?? But it just ain’t what I want.
HTTP URL 200 /blog/ # Blog index indeed. 200 /reserved/ # Test page indeed. 200 /blog/ux/ 200 /blog/ux/feature-proposal/ 200 /blog/hints/ 200 /something/ux/feature-proposal/hotapp-duplicate-file-dialog/ 200 /something/ux/feature-proposal/hotapp-support-negation-operator/ 200 /something/hints/hint-two/ 200 /something/hints/hint-one/ 200 /something/uncategorized/hello-world/
Setup 5: Reserved Pagename as Category Base + Posts Hierarchical
- Custom Structure:
/reserved/%category%/%postname%/
- Category base:
blog
- Tag base:
- Resulting URLs and their status code when queried:
- ? Static prefix
/reserved
which is a page slug on that system, and all blog-posts still work! Interesting find at least. - ?? But still that’s not what I want.
HTTP URL 200 /blog/ # Blog index indeed. 200 /reserved/ # Test page indeed. Conflict free! 200 /blog/ux/ 200 /blog/ux/feature-proposal/ 200 /blog/hints/ 200 /reserved/ux/feature-proposal/hotapp-duplicate-file-dialog/ 200 /reserved/ux/feature-proposal/hotapp-support-negation-operator/ 200 /reserved/hints/hint-two/ 200 /reserved/hints/hint-one/ 200 /reserved/uncategorized/hello-world/
Setup 3b: Strictly Hierarchical Blog at
/blog
with plugin- Custom Structure:
/blog/%category%/%postname%/
- Category base:
blog
- Tag base:
- Plugin: No Category Base (WPML): Activated
- Resulting URLs and their status code when queried:
- ? All category index pages fail too.
- ? All blogpost URLs return HTTP 404 Not Found.
- Explanation: Plugin deactivates category base altogether, hence categories not present at
/blog/*
HTTP URL 200 /blog/ # Blog index indeed. 200 /reserved/ # Test page indeed. 404 /blog/ux/ 404 /blog/ux/feature-proposal/ 404 /blog/hints/ 404 /blog/ux/feature-proposal/hotapp-duplicate-file-dialog/ 404 /blog/ux/feature-proposal/hotapp-support-negation-operator/ 404 /blog/hints/hint-two/ 404 /blog/hints/hint-one/ 404 /blog/uncategorized/hello-world/
Setup 3c: Strictly Hierarchical Blog on root
/
with plugin- Custom Structure:
/%category%/%postname%/
- Category base:
– Doesn’t matter if filled, it is ignored entirely anyhow.
- Tag base:
- Plugin: No Category Base (WPML): Activated
- Settings → Reading → Your homepage displays: Your latest posts.
- Resulting URLs and their status code when queried:
- ? All URLs work fine
- ?? But not the “Setup 3” that I want.
HTTP URL 200 / # Blog index indeed. 200 /reserved/ # Test page indeed. 200 /ux/ 200 /ux/feature-proposal/ 200 /hints/ 200 /ux/feature-proposal/hotapp-duplicate-file-dialog/ 200 /ux/feature-proposal/hotapp-support-negation-operator/ 200 /hints/hint-two/ 200 /hints/hint-one/ 200 /uncategorized/hello-world/
Thanks for any hints!
- The topic ‘Purely hierarchical URL scheme for blog on level below root with Core or Plugin’ is closed to new replies.