masasam / emacs-easy-hugo

Emacs major mode for managing hugo
https://gohugo.io/tools/editors/#emacs
GNU General Public License v3.0
355 stars 26 forks source link

What about a Set Date to Now option? #37

Closed jackbaty closed 6 years ago

jackbaty commented 6 years ago

Sometimes it takes a while between starting a post and publishing it and I forget to fix the date so that it reflects the actual publish time.

I would love an easy way to set a post's date to now. Something similar to the way easy-hugo-undraft works but it would update the date: (and probably lastmod:) in the frontmatter to the current date/time.

masasam commented 6 years ago

Hi @jackbaty. Thank you for comment.

The hugo undraft command has been removed with hugo 0.35 (https://github.com/gohugoio/hugo/issues/4353).

According to bep who is hugo developer, it is easier to undraft content by editing manually the frontmatter of said content by setting the draft flag to false, or removing it completely, than to rely on the undraft command which is a source of many bugs.

Updating timestamp has also been removed. (https://github.com/gohugoio/hugo/commit/2fa70c9344b231c9d999bbafdfa4acbf27ed9f6e)

So I will remove the easy-hugo-undraft and try to implement the command to get the current time. This works as follows

title: "About" date: 2018-02-15T14:51:09+09:00 draft: false

You delete 2018-02-15T14:51:09+09:00 manually, You execute M-x easy-hugo-current-time, It will display 2018-03-01T02:06:09+09:00.

jackbaty commented 6 years ago

I hadn't seen that they removed Undraft, thanks for the link. A timestamping command would be handy, so thanks for considering it!

masasam commented 6 years ago

Hi @jackbaty . I've implemented easy-hugo-current-time. Please use it.

According to github support, it seems that your email address is incorrect so it is not appear on easy-hugo contributors.

Below is the message of github support.

Thanks for reaching out to GitHub Support!It looks like that user used an email address for their commit that isn't actually associated with their GitHub account, which would explain why it's not being counted.https://github.com/masasam/emacs-easy-hugo/commit/7b6cbee24760ac283ee5393ca666eb3df04c11f3.patch Could you ask them to add that email address to their account. Alternatively, you can ask them to write into us directly about this.Cheers,John GitHub Support

jackbaty commented 6 years ago

easy-hugo-current-time works for me, nice!

Thanks for the note about my commit email address. I've fixed it in my account.

Easy-hugo really makes working with Hugo easier. Thanks for this!