-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
docs: Rewrite “Archetypes” article #3543
Conversation
This looks very good, but one underappreciated feature of the archetype files that doesn't really get enough attention is that you can fill in the "content section", which is really useful if you have a common layout/disposition for a type of article (with headers etc.). |
Great point. I'll work on adding that to the article. |
@bep I've added a "Scaffolding Content" section to the article that discusses this feature. Side note: It'd be great if anyone who uses archetypes could submit examples of theirs, as I think linking to archetypes for the sake of "inspiration" would encourage people to use the feature. |
Nice work! Quick note: "front-matter" should be "front matter" |
This is excellent -- the way you put it, the "content scaffolding" looks even more useful than I thought ... While we're at it: Could you add this issue to the Notes section: #452 It is an issue I had hoped somebody else could fix, but I guess I will get to it eventually. It is a slightly annoying thing about archetypes that the field order gets "messed with". |
docs/content/content/archetypes.md
Outdated
## Theme Archetypes | ||
|
||
Whenever you generate a content file with the `hugo new` command, Hugo will start by searching for archetypes in the `archetypes` directory, initially looking for an archetype that matches the content's section and falling-back on the `default.md` archetype. If no archetypes are found in this directory, Hugo will continue its search in the `archetypes` directory of the currently active theme. In other words, it's possible for themes to come packaged with their own archetypes, ensuring that users of that theme format their content files with correctly structured front-matter. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and falling-back on the
default.md
archetype.
This doesn't seem technically correct to me, because I don't believe the look up falls back on the defaults before looking to the theme. I think it looks for matches at the top level, then the theme, then defaults at the top level or defaults in the theme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that. I just tested it and it does hit the default first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hate to be a pain on this, but I think it's easy to get tripped up on default behavior. So, perhaps, after "and falling-back on the default.md
archetype" you can say something like "if one is present" because if there's a default archetype in the top-level directory, any archetypes that exist only in the theme will be ignored.
@bep I've added a reference to the issue within the article, rather than under the "Notes" heading. I think it's easier to understand in context, but I can change this if need be. @budparr Thanks for the input. I've made the requested changes. To further illustrate the way Hugo handles defaults, I've tried making a flowchart in Sketch, but I'm not a designer, so clarity might still be an issue. Either way, I think flow-charts would help to clarify the decision-making that Hugo does. |
Hey, @davidturnbull I think it'd be good to include your graphic. It can always be improved later, but I think it adds clarity. |
This is pretty freakin' fantastic @davidturnbull One consideration you might want to take a look at is the content on the docs concept, which is already quite different from what is on the gohugo.io: https://hugodocs.info/content-management/archetypes/ That said, I don't want you to have to do any work twice, so let me know how I can help facilitate. And I agree with @budparr that the graphic is a nice addition 😄 Thanks for these revisions. |
@rdwatters Bringing in the unreleased docs concept is adding confusion and isn't very helpful. Let us focus on this article which is targeted to get merged into this repository. |
How would you recommend I make sure @davidturnbull 's improvements don't get lost when we finally get the new docs site up and running? |
@rdwatters I would recommend that discussion to be taken somewhere else. |
@budparr Flowchart has been added. |
@bep Any further changes required for this? |
This pull request 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'd like to rewrite a significant portion of the Hugo documentation, to improve clarity and accuracy, and this is my first attempt at doing so.
Suggestions and changes are welcome.
:)