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 option to auto-add the lastmod variable to front-matter #66
Comments
This counters a requirement that all posts need not have dates. See #59. Can you provide an example where the date is reported as: Updated on January 01, 0000? |
This commit d53b557 specifically prevented that from happening. If a date is absent for a post, you can prevent the false date stamps in HTML by having something like below in your theme: {{ with .Params.date }}
<span class="post-date">{{ dateFormat "Mon Jan 2, 2006" . }}</span>
{{ end }} |
Hmm, I'm not sure this is a better solution -- it means I need to have a static post-date in my theme, right? I'm not sure my hack is the right way to solve hte problem, but it seems to me that one oughtn't to be required to enter the date evry time one updates a post or page. What do you think? |
I didn't follow that. The date is derived from the front-matter. In {{ with .Params.date }}
<span class="post-date">{{ dateFormat "Mon Jan 2, 2006" . }}</span>
{{ end }}
Hmm, that's a different use case.. For instance, I wouldn't want to update the So this has to be a separate feature.. that does not change the current understanding of a the I looked through Hugo Discourse forum and this might be something that you need: https://discourse.gohugo.io/t/how-to-use-modified-timestamp-from-file-as-lastmod/3576/15 You need to use Another option discussed in that thread is using |
See this commit.. 3a1b67a |
Thanks, I didn't understand the hugo date formatting functions, the clarification helps.
yes good point. Though I think my patch will only add the date if there's no date embedded in the post. org2blog/wp sort of solves this issue by adding a date property to the exported tree automatically if it's not present. One could do that. I personally like using the mod date as I am always revising these documents over the course of a semester, though of course since I export subtrees it's a bit hard to do that.
yes, that seems like a good idea to me actually. Am only slowly figuring out what you're telling me as I write my responses!
looks cool but for me it's a bit tough as I am not currently saving the md files to git at all -- so I don't think that solution would work for me personally (and probably not for a lot of potential ox-hugo users, since most of us are probably only registering the osurce files in git, right? |
The Now it's a different story if you plan to run
That's understood if you don't want to commit the .md files.. How are you publishing your site at the moment? In the meanwhile, let me rename this Issue to a feature request for addition of auto-setting of the |
That's exactly the issue raised in #59. Think about it.. all posts do not need to have a date stamp. If a user wants no date association with a post, they can skip the We can instead have a feature that if |
My method right now is very clumsy. my source files are local in Dropbox and also exposed on Github (https://github.com/titaniumbones/Hacking-History/tree/2017). To publish I run |
Yeah, that sounds way better. It's a far superior option. |
That looks too complicated :P I can suggest Netlify (it's free, and provides https for free too). The only setting I need to build the site is in this little screenshot: The build command looks complicated because I want to build the site using my self-built development version of Hugo. If you want to build using stable releases of hugo, simply set that Build Command to
|
@titaniumbones Try out the latest commit. See |
At present, if the EXPORT_DATE and DATE properties are empty, Hugo reports the date of posts as "Updated on January 01, 0000". Instead, actual date up update should be reported. (or a more sophisticated system should be used).
The text was updated successfully, but these errors were encountered: