This page permanently redirects to gemini://jorgesanz.net/posts/2023-04-16-re-my-create-article-script/.
Jorge Sanz | 2023-04-16 | 262 words | meta, techie
This is a reply to re: my create article script[1] by reidrac (gemini) and my create article script[2] by yretek (gemini).
=> 1: gemini://capsule.usebox.net/gemlog/20230415-re-my-create-article-script.gmi | 2: gemini://yretek.com/english/gemlog/2023/04/2023-04-15_My_create_article_script.en.gmi
--=--=--
In my case, using "hugo" to generate my web and capsule, I can leverage its nice templating system for new content called archetypes[3]. This system allows you to have templates that will be used by the "hugo new" subcommand. Just to save some keystrokes I have a couple extra wrapping functions on my shell that include the logic for the date and location of the file:
=> 3: https://gohugo.io/content-management/archetypes/
$ grep hugo-new .zshrc function hugo-new-post { hugo new posts/$(date +%Y)/$(date --iso)-$1.md } function hugo-new-update { hugo new posts/$(date +%Y)/$(date +%Y-%m).md --kind update }
So I have one function to generate posts with a default template and another to produce entries for my update[4] category. The former calls the "hugo new" subcommand storing the file in the year folder, using the passed parameter as file name with the date prepended in ISO format. The latter does not need any parameter, it just uses the date.
For example, today I run:
$ hugo-new-post new-article Content "/home/j/src/personal/jsanz.srht.site/content/posts/2023/2023-04-16-new-article.md" created
And that generated the file has the following content:
$ cat content/posts/2023/2023-04-16-new-article.md --- title: "2023 04 16 New Article" date: 2023-04-16T20:16:00+02:00 languages: [ 'english' ] categories: [ 'update' ] outputs: ['html', 'md'] description: > ... images: - ---
The markdown file with the frontmatter is ready to start writing. After editing the title, since I am posting this just for the capsule, the "description" and "images" properties are not necessary and I removed "html" from the "outputs" property as well.
And that's it. I will leave for another occasion to describe how my website and capsule are generated with Hugo.
--=--=--
Want to comment anything? Continue the discussion here[5] or contact me![6]
=> 5: https://mapstodon.space/@jorgesanz/110210457114709227 | 6: /contact
No webmentions yet.
=> This capsule is in LEO | Next Page | Last Page | Random Page This content has been proxied by September (3851b).Proxy Information
text/gemini;lang=en