From 4fc5454aff7f2f0faa77ec76709b64c77671a142 Mon Sep 17 00:00:00 2001 From: Joseph Hale Date: Thu, 9 May 2024 00:54:44 -0700 Subject: [PATCH] refactor: Extract maintainer instructions into a shortcode The maintainer instructions are essentially identical between announcements. No need to facilitate duplication of writing where it's unnecessary. Additionally, the shorter announcement template makes it easier to find the TODO line describing next steps for the contributor. --- archetypes/default.md | 16 +++++++++++++++- content/no-maintenance-intended/index.md | 18 +----------------- layouts/shortcodes/maintainer_instructions.md | 17 +++++++++++++++++ 3 files changed, 33 insertions(+), 18 deletions(-) create mode 100644 layouts/shortcodes/maintainer_instructions.md diff --git a/archetypes/default.md b/archetypes/default.md index c2a5f28..78aeffe 100644 --- a/archetypes/default.md +++ b/archetypes/default.md @@ -1,6 +1,20 @@ +++ title = '{{ replace .File.ContentBaseName "-" " " | title }}' -date = {{ .Date }} +slug = '{{ .File.ContentBaseName }}' type = "psa" draft = true +[[resources]] + src = "badge.svg" + name = "badge" +++ + +## Visitors + +Thanks for your interest in using open-source software! + +You're probably here because a project linked to this page. Here's what the +author(s) of that project want you to know: + - [ ] TODO - What do you want visitors to understand when they visit a project + displaying this PSA? + +{{% maintainer_instructions slug="{{ .File.ContentBaseName }}" %}} \ No newline at end of file diff --git a/content/no-maintenance-intended/index.md b/content/no-maintenance-intended/index.md index 5980a1c..f7c87a0 100644 --- a/content/no-maintenance-intended/index.md +++ b/content/no-maintenance-intended/index.md @@ -22,23 +22,7 @@ author(s) of that project want you to know: - The code is open-source, so feel free to make a fork to resolve any shortcomings for your needs. (remember to give credit where it's due) -## Maintainers - -Here's how to add the badge for this Public Service Announcement to your README - -[![](badge.svg)](no-maintenance-intended.md) - -**Markdown** -``` -[![No Maintenance Intended](https://PSAs.dev/no-maintenance-intended/badge.svg)](https://PSAs.dev/no-maintenance-intended) -``` - -**ReStructured text** -``` -.. image:: https://PSAs.dev/no-maintenance-intended/badge.svg - :target: https://PSAs.dev/no-maintenance-intended - :alt: No Maintenance Intended -``` +{{% maintainer_instructions slug="no-maintenance-intended" %}} --- diff --git a/layouts/shortcodes/maintainer_instructions.md b/layouts/shortcodes/maintainer_instructions.md new file mode 100644 index 0000000..57a6a74 --- /dev/null +++ b/layouts/shortcodes/maintainer_instructions.md @@ -0,0 +1,17 @@ +## Maintainers + +Here's how to add the badge for this Public Service Announcement to your README + +[![](badge.svg)]({{ .Get "slug" }}.md) + +**Markdown** +``` +[![{{ replace ( .Get "slug") "-" " " | title }}]({{ .Page.Site.BaseURL }}{{ .Get "slug" }}/badge.svg)]({{ .Page.Site.BaseURL }}{{ .Get "slug" }}) +``` + +**ReStructured text** +``` +.. image:: {{ .Page.Site.BaseURL }}{{ .Get "slug" }}/badge.svg + :target: {{ .Page.Site.BaseURL }}{{ .Get "slug" }} + :alt: {{ replace ( .Get "slug") "-" " " | title }} +``` \ No newline at end of file -- 2.51.2