Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show count against tag/category #3625

Open
1 task done
ChillarAnand opened this issue May 14, 2022 · 5 comments
Open
1 task done

Show count against tag/category #3625

ChillarAnand opened this issue May 14, 2022 · 5 comments

Comments

@ChillarAnand
Copy link
Contributor

Requested Feature: (short description)
Screenshot 2022-05-14 at 13 30 21

In tags page, currently only tags/categories are shown.

Does this feature affect backwards compatibility? If yes, in what way?

No

Do you want to contribute this yourself as a pull request? (don’t worry about it if you don’t want to/can’t — someone else can take care of it)

  • Yes, I don’t have code ready yet (that’s okay!)

Rationale and full description: (why should it be added to Nikola?)

Screenshot 2022-05-14 at 13 26 49

Most of the blogging platforms(like blogger, wordpress) have this feature by default. Having count against tag/cateogry gives a glimpse on how many items are present against each tag.

There are nikola plugins that do generate tag count, tag cloud etc. Some of them just generate json files. Users have to setup custom code for front end.

Since nikola already generates taxanomies, showing count along with it will provide better insights by default.

@feoh
Copy link

feoh commented May 21, 2022

I love this idea, but I wonder about how the layout would need to change in order to display this information in a mobile friendly way that makes sense.

The example you show uses a fully vertical layout, and I rather like the current horizontal list layout the default Nikola theme currently has.

@felixfontein
Copy link
Contributor

The main problem with showing numbers is that it requires all pages that include them to be regenerated when any of these counts change. If you have such information in a sidebar, it means that every single page has to be generated when adding a blog post or something, which goes against Nikola's philosophy of incremental builds. But including them in standalone pages (like tags/categories page) should not be a problem.

There are nikola plugins that do generate tag count, tag cloud etc. Some of them just generate json files. Users have to setup custom code for front end.

Or you have a second pass. I'm using that with my sidebar plugin (https://github.com/getnikola/plugins/tree/master/v7/sidebar) and then do a second pass with https://github.com/felixfontein/filetreesubs/ to have this HTML fragment included into every page without forcing Nikola to rebuild all pages. (The substitution step is pretty fast, while a Nikola full rebuild for my blog takes quite a long time.) But this is not trivial to set up...

@Kwpolska
Copy link
Member

@feoh A layout like this could work:

image

(Although I think our tags/categories page looks kinda ugly and unreadable if there are lots of tags and the screen is wide.)

@ChillarAnand
Copy link
Contributor Author

I didn't get a chance to work on this. If someone is willing to take it up, please go ahead.

@ChillarAnand ChillarAnand removed their assignment Oct 16, 2022
@padawan
Copy link

padawan commented Feb 11, 2023

If you have such information in a sidebar, it means that every single page has to be generated when adding a blog post or something, which goes against Nikola's philosophy of incremental builds.

Movable Type provides a nice way of doing this. It allows the sidebar to be defined in a cached template, that is rendered only once, then included in any other site template that needs it, either statically (the once-rendered cached content) or using an Apache or a PHP include server-side. Ways of caching and including are configured as metadata of the template. MT even lets you tell it when to invalidate that cache, for example if there has been a change in the categories, or a new categorised entry added then regenerate this particular template. This way it will only regenerate the minimum amount of files. Using the web server to perform the inclusion dynamically allows to just regenerate a single file and enjoy instant update where regenerating whole lists of pages would be prohibitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants