Mitrichius / hugo-theme-anubis

Anubis is a simple minimalist theme for Hugo blog engine
https://hugo-theme-anubis.netlify.app/
MIT License
397 stars 152 forks source link

`lastMod` support #184

Closed SandaruKasa closed 1 year ago

SandaruKasa commented 1 year ago

Based upon #183

Improvemtns:

Non-improvements:

netlify[bot] commented 1 year ago

Deploy Preview for hugo-theme-anubis ready!

Name Link
Latest commit b169058e7190f381448adb8ee3d7f7b4de02507c
Latest deploy log https://app.netlify.com/sites/hugo-theme-anubis/deploys/647fb3a4bce1d10009bf2ea3
Deploy Preview https://deploy-preview-184--hugo-theme-anubis.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

ihsanpraditya commented 1 year ago

Does it work with you? I need to add enableGitInfo = true in config.toml.

SandaruKasa commented 1 year ago

Does it work with you? I need to add enableGitInfo = true in config.toml.

Works for me with the exampleSite of this repo and Hugo v0.112.3, as well as Hugo v0.92.0.

SandaruKasa commented 1 year ago

Does it work with you? I need to add enableGitInfo = true in config.toml.

Works for me with the exampleSite of this repo and Hugo v0.112.3, as well as Hugo v0.92.0.

But yes, I do have to manually specify "lastMod" in the .md file.

I guess enableGitInfo would do this automatically for me.

M1ndo commented 1 year ago

@SandaruKasa Add a space in 16:post-info.html next to </time>] image image

SandaruKasa commented 1 year ago

@SandaruKasa Add a space in 16:post-info.html next to </time>] image image

Weird, it isn't supposed to look this way. It should've been

2018-03-23 [Last modified: 2022-11-05]

But the "Last modified:" got lost somehow (I guess i18n decided to fallback to empty string instead of English?), so now it looks like I've missed a space to the right:

2018-03-23 [ 2022-11-05]
M1ndo commented 1 year ago

@SandaruKasa Add a space in 16:post-info.html next to </time>] image image

Weird, it isn't supposed to look this way. It should've been

2018-03-23 [Last modified: 2022-11-05]

But the "Last modified:" got lost somehow (I guess i18n decided to fallback to empty string instead of English?), so now it looks like I've missed a space to the right:

2018-03-23 [ 2022-11-05]

My bad, apologies. I applied your patch and forgot to the language patch, your patch 100% works. Thanks for adding it!, btw would you consider adding another one related to adding the latest modified posts on the index page first by date?

SandaruKasa commented 1 year ago

btw would you consider adding another one related to adding the latest modified posts on the index page first by date?

Sorry, I don't think I get what you mean exactly. Modifying layouts/index.html to add a second list of posts (the edited ones, ordered by lastMod) before the main one?

M1ndo commented 1 year ago

btw would you consider adding another one related to adding the latest modified posts on the index page first by date?

Sorry, I don't think I get what you mean exactly. Modifying layouts/index.html to add a second list of posts (the edited ones, ordered by lastMod) before the main one?

Posts order is by date from older to newer posts at the top, when a post has LastMod that's newer add it to the top of the posts in the main index page like a new post. i've tried couple things like range $Pages.Page.Params.LastMod.Reverse but it didn't work out.

SandaruKasa commented 1 year ago

Posts order is by date from older to newer posts at the top, when a post has LastMod that's newer add it to the top of the posts in the main index page like a new post. i've tried couple things like range $Pages.Page.Params.LastMod.Reverse but it didn't work out.

Ah, sorry, I don't think I know how to do it either. Plus, I don't really see a use case for such behavior. It might make sense to put it behind a feature flag, because why not, but this really feels like a separate feature to me, so maybe it might make sense to submit it as a separate, follow up PR. For now, I would really love to see at least this one merged.

Mitrichius commented 1 year ago

Thanks for this PR!