Thanks to visit codestin.com
Credit goes to github.com

Skip to content

User-defined taxonomies #246

@sjml

Description

@sjml

(I reached out to @Keats on Twitter to ask about this, and he said to open an issue here, so here it is.)

I was considering starting work on a PR to allow for user-defined taxonomies. What I have in mind is fairly simple (and what I already have implemented in my own, very basic Python SSG), but I don't want to start in on it if it's the wrong thing or not wanted.

Like in Hugo, you declare the singular and plural form of the taxonomy in the config.toml. (From here out, I don't know if this matches or diverges from Hugo's behavior; I never went down the road too far on it because I was implementing my own by then.)

When parsing frontmatter, if any of the fields match a taxonomy name, the page or section is added to that taxonomy under the given term or terms, passed through a slugify text filter to make sure they can live in a URL.

Where this becomes useful is being able to declare, for instance, that author = "authors" is a taxonomy, so that author data in frontmatter generates a page where you can see all content from a specific author, without having to do any additional work. It makes http://example.com/authors into a list of the authors.

This is something that could be accomplished via tagging, but it keeps things a bit cleaner to be able to use possibly-existing data.

Now it could be that I've simply overlooked or misunderstood some part of the Gutenberg documentation -- if this is easily accomplishable with existing functionality, please let me know!

If not, I'm happy to start making an effort at adding the functionality, provided @Keats gives a thumbs up to the idea.

Metadata

Metadata

Assignees

No one assigned

    Labels

    done in prAlready done in a PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions