Hello all,
I went into an overhauling mood for displaying tags and categories on my site last night
The new buttons for tags and categories blend better into my site (https://scripter.co).
- Hovering over those shows the number of posts with the same tags/categories.
- Tag buttons are in the light grey background, category buttons are in the dark grey background.
- Clicking on a button will show posts only with that taxo. But on that page, that particular taxo button is colored in my site’s theme color (maroon/reddish)! This one needed a nasty hack as the buttons are created in a Render view, and the view does not know the Term of the current
taxonomy
Kind page (e.g. /tags/foo/)… and you cannot pass variables to the.Render
. - Re-used the same taxo buttons on post singles.
- Custom hover text for those buttons (
title
attr) based on if there only 1 post with that tag/category, or more, whether it’s a tag or a category. - Switched from list of tags/categories in terms.html to a series of buttons with their sizes proportional to the number of posts (tag cloud). Example: https://scripter.co/categories/. The size variation is not quite there as I yet need to organize categories and tags better… You’ll find that I never set a tags taxonomy in my older posts.
- Reused the same taxo buttons on list pages too. Example: https://scripter.co/posts/.
- You won’t find /tags or /categories hard-coded in any of my templates.
- And no Javascript involved anywhere!
Click through the taxo buttons on my site to see what I mean.
And here are the relevant bits:
- The
taxo-buttons
partial. - Re-use of that partial in
single
,summary
,li
. - The ugly hack in
taxonomy
for.Render
limitation that I mentioned earlier. Thetaxo-buttons
partial implements the complementary part of that hack. - The taxo “cloud”:
terms
, and the related CSS.