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
Add "main sections" site config #3206
Comments
/cc @rdwatters |
As a workaround I would propose that users should define a list of sections that should be used to filter the content files. Only content that is part of one of these sections will be displayed:
|
With the ability to override in site config, I assume? Then YES. This will at least cover the discrepancies for the most common use case with existing themes (i.e., blogs who want to use "blog," "posts," and even "articles"). Are you thinking you would extend/abstract this even more for larger sites; e.g., primary section, secondary section, etc., @bep? As an aside, I think there is value in being a little more prescriptive in our "submit a theme" docs for known knows: e.g., relURL. |
@bep How are you feeling about this? Shall we add a user feedback tag? |
No, let us wait. There is too much going on at the moment. |
OK, this will take some time to get its way into the themes (we can do some bulk PRs to speed it up), so we should get it out in the wild sooner than later. I agree with @digitalcraftsman -- we do it simply with no magic.
▶ find . -name "index.html" | xargs grep "\"post\"" | wc -l
56
~/hugo/hugoThemes master ✔ 82d
▶ find . -name "index.html" | xargs grep "\"blog\"" | wc -l
5 Addendum: We should probably use the "biggest section" as a default if not too much work finding it. |
Agreed. Are you thinking total number of files for a top-level section? Just considering the work you're doing on nested sections and which of the following would qualify:
Or just that...
I think @digitalcraftsman, with respect to your example usage but tweaked slightly:
How would a theme developer define, for example, a primary vs secondary section; e.g. If this is up and running, I can help with PRs for themes. Might be a good opportunity for me to fix some of the other common issues. |
@rdwatters you raise a lot of questions not relevant to the current Hugo situation (there is only one level and we are not talking about secondary sections here). So the spec is:
|
From my previous comment but with emphasis added:
Then why "Secondary" and not "nested," as in, for example, "primary" having 60 files and "secondary" having 20 files, per my question above regarding how you want to calculate the biggest section and my example of Thank you. |
So there can be many main sections (up to the user), and there will be an implicit order (array index), but the common usage doesn't care about that order. We haven't defined a use case where order is important, so we don't make it more complex than it is. And if the user have not specified what he wants, we make a guess by counting. And that is currently very simple. No hard rules. If two sections have the same amount of pages, one of them wins (ordered by section title, maybe, it doesn't matter as long as it is stable). So if primary have 60 files and secondary have 20 files, which section do we pick? The primary. |
Got it. Thanks for the example @bep. I'm grokking it now and trust that you have all this covered w/r/t your future plans for nested sections. I only ask to learn 😄 And 👍 on |
The addition of |
... but thinking about it I think we should make it |
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. |
I scribble this down, it may be a crazy idea.
But thought of this when reading the "default theme" thread.
One of the main issues we have with themes is the portability, they make some assumptions that aren't common to all themes.
One of them is this construct in the home page template:
And similar. Which is bad if the main section is named something totally different.
One other option is then:
But, what if we nominate the section with most pages as somewhat special:
Or even better:
The text was updated successfully, but these errors were encountered: