Skip to content

Conversation

@luke6Lh43
Copy link
Contributor

@luke6Lh43 luke6Lh43 commented Nov 24, 2025

Hi all,

I’d like to propose this small change in Docs/Contributing/Blog after encountering some issues while creating my recent blog post. I blindly copied and pasted the sample commands, which still referenced the year 2024, resulting in my new blog post being created in the wrong directory. I then had to fix this in my local repository and move it to 2025.

To help prevent this for others, I have:

Updated the sample commands to use 2025 in the path
Added comments in brackets reminding users to check the path and year

Ideally, it would be great to have automation that updates sample commands across the docs each year on January 1st :)

Thank you for considering this improvement!

@luke6Lh43 luke6Lh43 requested a review from a team as a code owner November 24, 2025 04:21
@otelbot-docs otelbot-docs bot requested a review from a team November 24, 2025 04:22
@luke6Lh43 luke6Lh43 force-pushed the fix/docs-contributing-blog-commands-2025 branch from 9e7e359 to 9015cee Compare November 24, 2025 04:26
Copy link
Member

@theletterf theletterf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Perhaps we could change the year in that command with {{ time.Now.Year }} — WDYT @chalin ?

https://gohugo.io/functions/time/now/

Copy link
Contributor

@chalin chalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luke6Lh43, thanks for point this out!

Thanks! Perhaps we could change the year in that command with {{ time.Now.Year }} — WDYT @chalin ?

Right, I'd prefer that, but it's a bit tricky without a shortcode. Let me think about this.

Copy link
Contributor

@chalin chalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@luke6Lh43 - please revert the changes to the prose, and replace:

  • 2024 by $(date +%Y) in the two shell commands
  • See inline comment for the other suggestion

@chalin chalin force-pushed the fix/docs-contributing-blog-commands-2025 branch from 9015cee to 28dff3c Compare November 24, 2025 09:35
@otelbot-docs otelbot-docs bot requested a review from a team November 24, 2025 09:35
@luke6Lh43
Copy link
Contributor Author

Hi @chalin . I have updated content/en/docs/contributing/blog.md with your recommendations. However, I don't see $(date +%Y) to be working correctly in both VS Code Markdown preview and when reviewing file on Github. Do I understand it correctly that it is something Hugo specific that will work on a website once published?

@luke6Lh43 luke6Lh43 requested a review from chalin November 24, 2025 15:08
@theletterf
Copy link
Member

@vitorvasc
Copy link
Member

I'd say the $(date +%Y) is only meant to work when running a shell command, not to dinamically render the current year in the page. The year references inside the page content still show up as YYYY.

I tried running the command below, and the page was correctly created under content/en/blog/2025:

npx hugo new content/en/blog/$(date +%Y)/short-name-for-post.md

@theletterf
Copy link
Member

@vitorvasc 🤦🏻 You're right. I think we can go ahead then. :)

@chalin chalin force-pushed the fix/docs-contributing-blog-commands-2025 branch from 45f32e7 to 7198412 Compare November 26, 2025 19:28
@chalin
Copy link
Contributor

chalin commented Nov 26, 2025

Thanks. I'll let @vitorvasc and @theletterf handle it from here (I'll be OOO).

@vitorvasc vitorvasc force-pushed the fix/docs-contributing-blog-commands-2025 branch from 7198412 to a5a773a Compare November 29, 2025 14:19
Copy link
Member

@vitorvasc vitorvasc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @luke6Lh43!

@vitorvasc
Copy link
Member

@theletterf leaving it with you for a final review and merge! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants