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
Design Proposal: defaultDate & defaultTitle #4341
Comments
Here are my thoughts on config flags:
We're not adding any In my head we have:
No more. And they have an implied and sensible order: For
For
There will always be some people wanting really special things. But flexibility comes at a cost. Note that if implementing this as a "slice of something" internally makes it simpler, fine, but we're not adding a "config date matrix" unless it is needed and/or makes this significantly simpler to understand/configure. |
As I explained in another comment, my real goal is simply for Hugo to properly support content without front matter. So I'd be completely happy with: For
For
Whether this happens by default or by configuration switches, I don't care. I proposed the above as a way to keep everyone happy, as well as set Hugo up for new behavior without creating boolean config switch hell. The advantage of symbolic switches is that you can have a single config property for an item, and introduce new options simply by adding new legal values. You keep the door open for supporting other things even if unlikely, e.g. customized precedence order, arbitrary regular expressions, whatever. It's just a matter of supporting a new legal value. It is just an idea. Perhaps a bad one. Before we make any decisions on config switches, I think we should decide whether Hugo will support #285, #3805 and #4359. Will Hugo will support content without front matter? Should I start a forum topic? [1] This is important because so much Markown content already exists with a title, right there in the content at the top as a heading. Why force authors to add it again in front matter, and have to keep them in sync when they change the title? [2] The case where both date and title are in the filename must be considered. |
FWIW, this would be great! I am OCD (and also that's invalid HTML) about not having multiple At the moment, I ensure that there are no level-1 Markdown headings in my posts, because Blackfriday will render all those headings as |
Any progress on this yet? I would love to use Hugo without any front matter as it makes importing my markdown files a lot easier and it is more true to the nature of easy publishing markdown files. |
@bep implemented the date part of my proposal in #4436. My earlier PR to extract title from filename (#4359) was not accepted.
Exactly!!! This is something I'm working on, both as a standard and a Hugo implementation of the standard. Feel free to check it out (you'll have to build it for yourself for now). At the moment it does this:
Additional features forthcoming... And hopefully I'll be ready to publish the standard proposal soon. |
Seems handy, and I agree that there should be only 1
What about CommonMark and keeping it true to the spec (if you believe there is such a thing) @vassudanagunta ? |
Absolutely! I'm an active participant of the CommonMark community and am "all-in" with regard to CommonMark. Maybe you misunderstand? Markaround doesn't change the Markdown spec (whichever flavor you use). It specifies how you assembly a collection of Markdown files together (e.g. Hugo's content folder). In fact, it is in some ways an "un-specification", in that it says you can organize your pure-Markdown content within a root folder any way you wish, and a Markaround compliant tool (editor, SSG, etc) has to be able to handle it as-is. The link examples above are pure Markdown, and are already supported by many tools and GitHub. If, for example, the Hugo Docs used links like the above (rather than proprietary I'd love to hear your thoughts. |
Thanks for the great intel, @vassudanagunta . I see your point now 😄 That said, I don't want to get this thread too off track, which I am often wont to do. Also, thanks much for the inadvertent intro to Typora. That app is beautiful. |
Thanks for the kind words, @rdwatters. 😄 We'll pick up this tangent later, after I push out a draft fo the Markaround spec. I'd love to get your feedback. Send me an email if you're open to me running questions or ideas by you as I flesh it out. |
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. |
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 changed my mind. I now like @maxandersen's improvement (#3762) of @devjack's implementation (#3310) of @xaprb's now nearly 4 year old request (#285). A single config value. A simple bool that enables "smart" date detection (that could get smarter over time), rather than asking the user to figure out a regex:
concerns
useModTimeAsFallback
anduseFilenameDateAsFallback
are both set to TRUE?keepDateInSlug
? Hmmm.an alternate solution
This proposal address #285, #3805 and #4340 and all of the concerns above. Compare the set of settings above to this:
defaultDate
defaultDate
has the following symbolic values (final identifiers may be different):none
in filename
same as Better more complete fix for allowing filename to set date and slug #3762remove from filename
same asin filename
, but removes date from slugfile mod time
same asuseModTimeAsFallback
, which we can deprecatefile creation time
future, if neededIn the future we can also distinguish between Date and PublishDate if necessary:
We can also use this setting to address #4340, replacing the currently hardcoded logic for defaulting Date, PubDate and LastMod to each other (which I think is problematic). We simply add a couple more symbolic values for the setting:
In the future we can also add precedence logic:
defaultTitle
We can give
defaultTitle
similar options:none
filename
full filenamein filename
filename less parts we've parsed for anything else, e.g. defaultDateheading
use the top level heading (H1) in the content as titlewe can do this incrementally
We don't have to support all of the setting values I show above immediately, or ever. But having the single string settings that accepts values from a documented enumeration of values is both simple and flexible. And if we really, really need to, we could one day allow it to be set to a regular expression.
The text was updated successfully, but these errors were encountered: