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

taxonomy-term.md under /content/taxonomy-name/ instead of the documented /taxonomy-name/taxonomy-term/ _index.md #3772

Closed
onedrawingperday opened this issue Aug 3, 2017 · 15 comments

Comments

@onedrawingperday
Copy link
Contributor

onedrawingperday commented Aug 3, 2017

Today it was reported by @guayom and reproduced by me, that one can pass custom parameters to a taxonomy list page simply by creating a taxonomy-term.md under /content/taxonomy-name/ instead of the documented /taxonomy-name/taxonomy-term/ _index.md

You can find the steps to reproduce this undocumented Hugo behavior at this post in the forum:
https://discourse.gohugo.io/t/solved-dynamically-filter-pages-by-taxonomy/7679/26?u=onedrawingperday

I took the rare step to open a Github Issue because I would like to know if we can safely use this way to pass front matter to taxonomy lists in our templates? Or do you consider it a bug?

In my humble opinion this makes it much easier to customise a taxonomy list page or even render a taxonomy terms menu.

This works in the latest Hugo with the default Pretty URLs setting.

This will not work with Ugly URLs enabled.

@bep
Copy link
Member

bep commented Aug 4, 2017

Or do you consider it a bug?

A bug if it works, but I have a hard time wrap my head around it.

@bep bep self-assigned this Aug 4, 2017
@bep bep added the Bug label Aug 4, 2017
@bep bep changed the title Alternative way to add content and front matter to a taxonomy list. taxonomy-term.md under /content/taxonomy-name/ instead of the documented /taxonomy-name/taxonomy-term/ _index.md Aug 4, 2017
@onedrawingperday
Copy link
Contributor Author

onedrawingperday commented Aug 4, 2017

@bep To clear things up Hugo thinks that the front matter from the content page under /brands/nike.md/ refers to the taxonomy list page under /brands/nike/

If you want to give me an email, I can provide you with a Hugo project as a ZIP to see this behavior with your own eyes.

@guayom
Copy link

guayom commented Aug 4, 2017

Hi @bep here's a repo that shows exactly what I did.

https://github.com/guayom/hugo-taxonomies

I don't know if this is a bug, I think that this is just the expected behavior for pages. In the readme I try to explain why.

@rdwatters
Copy link
Contributor

@bep, if I had to take a guess, maybe it's similar to the index.md vs _index.md in terms of users on the forums getting what they felt was an "expected" behavior until...all those index pages started to break due to unpredictable rendering order. (This is all from memory as I write on my phone.) If I were at my MacBook, @guayom, I would test whether the .GetPage behavior for taxonomy vs taxonomyTerm behaves as expected for your current source organization...

@onedrawingperday
Copy link
Contributor Author

Just tested what @rdwatters said and I am able to render content on the home page with:
{{ range ($.Site.GetPage "taxonomy" "brands" "nike").Pages }}

And I can confirm that @guayom 's content organization doesn't break the .GetPage function.

@bep
Copy link
Member

bep commented Aug 5, 2017

all those index pages started to break due to unpredictable rendering order.

And that is exactly why I'm labelling it as a bug here. I'm working on "page bundles" now, which is a very intricate balance and hard thing to do while still not breaking stuff, and having to also consider a set of accidental corner cases is not something I'm willing to take on.

@onedrawingperday
Copy link
Contributor Author

onedrawingperday commented Aug 5, 2017

The most tanglible benefit of @guayom 's method is that the user can pass front matter to taxonomies without replicating the taxonomy URL as a folder path to insert the _index.md

Creating a folder per taxonomy term is not ideal IMO. And I opened this issue because this method looked like something that could save people time while organizing their Hugo project.

But you've already stated what you think @bep and you are the one who knows best.

So if you want just close the issue. There's no point in having it open forever.

@rdwatters
Copy link
Contributor

@onedrawingperday @guayom My thoughts are as follows when it comes to discussions of content modeling and source organization with Hugo:

  1. Can it be supported by the Hugo devs--I'm the only non-dev on the team, mind you--and has it been approved by the dev lead/maintainer (@bep)?
  2. Does it fit into the overall content/data model of how people use Hugo (e.g., think about the way we use _index.md currently for adding content and front matter to list pages [hint: taxonomy pages are list pages, as defined in the docs]). Experience breeds expectations breeds intuition.
  3. What's the most accurate and responsible way of supporting users on the forum in a way that creates less headaches for everyone involved in the future, and how can I help document a legitimate feature to help all Hugo end users.

Creating a folder per taxonomy term is not ideal IMO.

It's technically the exact same number of files created, so I take it your issue is with the number of directories? Maybe you're asking for a new kind of generator for taxonomies as a feature request then? (This is just me throwing out an idea; if you would want said feature, please open a new issue, of course 😄).

@bep
Copy link
Member

bep commented Aug 5, 2017

I agree that the content file in directory per taxonomy is cumbersome, but then fix that. Having one file per taxonomy in one single directory makes it just slightly better. What about thinking up some optimal solution to the problem instead of looking for workarounds? There is another issue asking for "content from data files"... Mix that thought with ...

@onedrawingperday
Copy link
Contributor Author

Well it's not very practical making a bazillion folders and open and close them all the time. Is it?

I have consciously avoided using taxonomies because of this.

But this discussion is kind of pointless as it has been made explicitly clear by @bep that this method is something he is not willing to support.

Also I will not open a new feature request and I am closing this issue as it has already been addressed by the lead maintainer and there is no point in discussing it further.

@bep bep reopened this Aug 5, 2017
@bep
Copy link
Member

bep commented Aug 5, 2017

@onedrawingperday this is an issue that needs a fix and will stay open. As to "willing to support": I have not looked into this issue, and as such cannot say anything qualified about it. The issue is here to remind me or others that we need to look into this. Hugo is an OSS project, driven by peoples' spare time, so expecting "within the hour" support is unreasonable.

@onedrawingperday
Copy link
Contributor Author

Not expecting support within the hour.

Never had. Never will.

@onedrawingperday
Copy link
Contributor Author

Right. @bep

I revisited this issue just now and it turns out that I never saw your comment #3772 (comment) as I was replying at the very same time.

As to the "willing to support" quote I was replying to the following:

Can it be supported by the Hugo devs

Apologies for closing the issue. It was a misunderstanding on my part.

And I didn't want my mobile push notifications polluted by a discussion that appeared to be going nowhere. If you or anyone else does anything about this issue it is entirely up to you. I wasn't trying to be pushy or anything of the sort.

And with that. Adios. I'm not really into Github or Forums anyway.

@stale
Copy link

stale bot commented Dec 6, 2017

This issue has been automatically marked as stale because it has not had recent activity. The resources of the Hugo team are limited, and so we are asking for your help.
If this is a bug and you can still reproduce this error on the master branch, please reply with all of the information you have about it in order to keep the issue open.
If this is a feature request, and you feel that it is still relevant and valuable, please tell us why.
This issue will automatically be closed in the near future if no further activity occurs. Thank you for all your contributions.

@stale stale bot added the Stale label Dec 6, 2017
@stale stale bot closed this as completed Dec 27, 2017
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants