hexo icon indicating copy to clipboard operation
hexo copied to clipboard

use tags and categories in pages

Open rhewitt22 opened this issue 9 years ago • 10 comments

Is there a specific reason for preventing pages from using tags/categories? It seems as if they are useful methods for relating content in cases where the site is larger than a standard tech blog.

rhewitt22 avatar Feb 26 '15 14:02 rhewitt22

I also would like to use categories and tags on pages.

DanielBaird avatar Mar 02 '15 04:03 DanielBaird

I would also like this feature

simonwjackson avatar Aug 17 '15 11:08 simonwjackson

Another vote for this feature.

NSBum avatar Apr 19 '18 09:04 NSBum

I believe this issue might be old, because I just tested with hexo with the following version: "hexo": "^3.7.1", "hexo-generator-archive": "^0.1.5", "hexo-generator-category": "^0.1.3", "hexo-generator-index": "^0.2.1", "hexo-generator-tag": "^0.2.0",

And you can use both: image

And the documentation display an example with both here: https://hexo.io/docs/front-matter#Categories-amp-Tags

Or am I misunderstanding your question? (Note that I believe this will depend on the capabilities of your theme. I was using the default theme https://github.com/hexojs/hexo-theme-landscape )

Can we close this issue?

tomap avatar Sep 15 '18 13:09 tomap

I have the same configuration, same theme but cannot generate tags or categories on pages (i.e. layout: page in front matter). I can do so on posts (layout: post in front matter.) Can you confirm that the above were generated on pages, not posts?

NSBum avatar Sep 15 '18 16:09 NSBum

5 years later

Issue

If post is a page sub-category, page should be able to use tags and categories too. It should be up to the theme to decided if they want to include tags and categories for pages in their layout or not. Actually not being able to use tags on something else than layout: post prevent a theme creator from using the list_tags helper on a page for example.

IF there is a technical reason please explain why, else just let enable tags and categories for every single layout: page, post (page), custom layout base on page, etc.

non working workaround

With pug and bulma I tried to achieve the same thing as list_tags(site.tags, {show_count: false, class: 'tag is-primary escape', style: false, separator: ''})

  if page.tags
    div(class="level-item has-text-centered")
      div(class="tags")
        each tag in page.tags
          a(class="tag is-primary" href="/tags/post/" + tag rel="tag")
            = tag

The display part works perfectly but the problem is that the /tags/post/taghere/ doesn't exist because it's generated for post only and /tags/page/taghere/ doesn't exist either.

Context

I am creating a theme for documentation, where I created a doc layout that inherits the page layout. The whole idea of the project in the first place was to make a statigen focused documentation where with tags support because there are many documentation staticgen but none has tags support. Until this issue is fixed my project is ruined because I can't use tags on something else than a post. Else I should begin back from scratch with middleman, nanoc or jekyll.

noraj avatar Jan 05 '20 20:01 noraj

IF there is a technical reason please explain why, else just let enable tags and categories for every single layout: page, post (page), custom layout base on page, etc.

I just briefly looked into the difference between page and post. page lacks an ID to link to a tag's ID.

It seems possible for page to have tag/category, once it has ID in its model and the necessary plumbing.

curbengh avatar Jan 10 '20 13:01 curbengh

Any chance to have this feature in the next release ? :smiley:

noraj avatar Apr 14 '20 10:04 noraj

Has someone the skill to complete this PR #4560 ?

noraj avatar May 29 '21 12:05 noraj

  • [x] Tags for pages support in Docusaurus https://docusaurus.io/feature-requests/p/add-tags-to-pages
  • [x] Tags for pages support in Retype https://github.com/retypeapp/retype/releases/tag/v1.6.0
  • [ ] Tags for pages support in Hexo

noraj avatar Oct 16 '21 17:10 noraj