Custom path for taxonomy pages?

Hey there,

first of all, thanks a lot for all the work you put into Zola. It’s an extremely enjoyable experience to work with it. :slight_smile:

I have a question about using the taxonomies feature, though. I am currently porting my website from Octopress to Zola, and I would like to be able to continue using the same URLs.

On my current website, I have a tags taxonomy, and the path for each tag is like this:

/blog/tags/{tagname}

Is there a configuration option that I missed for customizing the path of a taxonomy in Zola? Assuming a taxonomy called tags seems to be hardcoded to

/tags/{tagname}

I am not using pagination, so I don’t think the paginate_path can help me there.

I categorized this as Support, but maybe, if this kind of customization is not supported yet, it should be changed to Feature Request.

2 Likes

They are currently hardcoded. You have to keep in mind taxonomies can be language specific so it is a bit more complex than just having an option.

Thanks for confirming my assumption. Could you please clarify why a single option would be too simple? If I understand the multi-language feature and taxonomies correctly, right now, a language-specific taxonomy would have a hardcoded path that looks like this:

{base_url}/{code}/{taxonomy_name}/{term}

Sections seem to have a path that looks like this:

{base_url}/{code}/{section_name}/

So, in general, the {base_url}/{code} seems to be a given.

Now, imagine we had an option called taxonomy_path, and I have a taxonomy called tags with the following configuration:

taxonomy_path = "/foo/bar/"

Then I would expect the following URL for a term in a non-localized taxonomy:

{base_url}/foo/bar/{term}

And the following path for a term in a language-specific taxonomy:

{base_url}/{code}/foo/bar/{term}

At first glance, it looks to me like this could be handled with a single option. Please let me know if I am missing something or my assumptions are wrong.

Maybe, the name taxonomy_path is not ideal, and it should actually be taxonomy_slug, because for other content, path always seems to override the complete path after the base URL.

You are probably not missing anything. I remember there were some issues with taxonomies and multi-lingual sites, I’ll have to look again at the discussion to refresh my memory.
The only change to your proposal would be to have that live in config.toml as part of the taxonomies definition so it would probably just be named path.
Typing this made me remember what is missing with taxonomies/multilingual: taxonomies don’t currently take a lang so content might be duplicated if you have the same language with different locales and use taxonomies. That change can go in with your proposed path change I believe (breaking change however so for 0.7).

1 Like

Yes, I was thinking about this as well after I had already posted my previous comment in this thread. And I agree that path is probably a better name in this case.

I must admit that I am not sure what exactly you mean regarding taxonomies not taking a language, duplicated content as well as same language and different locales. My understanding based on Taxonomies | Zola is that taxonomies do take a language (but I think I just didn’t get what you were referring to), and I don’t even know about the concept of a locale in the context of Zola. It would be great if you could elaborate on this. :slight_smile:

By the way, would you prefer to implement my suggested changes regarding the taxonomy path yourself? I could imagine giving it a shot, but I may need some guidance.