Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 4 additions & 3 deletions .github/workflows/add-article.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,15 @@ jobs:
if not slug:
# Title was only punctuation / non-ASCII — fall back to the issue number.
slug = f"article-{os.environ['ISSUE_NUMBER']}"
filename = f"{today.strftime('%Y-%m-%d')}-{slug}.md"
route = f"/articles/{today.strftime('%Y-%m-%d')}-{slug}/"

fm = {
'title': title,
'author': author,
'authors': [author] if author else [],
'date': date_str,
'description': description,
'url': route,
}
if category:
fm['categories'] = [category]
Expand All @@ -89,8 +90,8 @@ jobs:
front = yaml.safe_dump(fm, default_flow_style=False, allow_unicode=True, sort_keys=False)
document = '---\n' + front + '---\n\n' + content + '\n'

filepath = f'content/articles/{filename}'
os.makedirs('content/articles', exist_ok=True)
filepath = f"content/articles/{today.strftime('%Y')}/{today.strftime('%m')}/{slug}/index.md"
os.makedirs(os.path.dirname(filepath), exist_ok=True)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(document)

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ jobs:
--minify \
--destination public

- name: Validate Article bundle output
run: npm run validate:articles

- name: Validate iCalendar feed
run: node scripts/validate-calendar.mjs public/calendar/calendar.ics

15 changes: 9 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ If you're not comfortable with Git, you can pitch or submit your article through

1. Fork this repository
2. Create a new branch for your article
3. Add your article as a Markdown file in `content/articles/` using this naming convention:
3. Create an Article leaf bundle beneath its publication year and month:

```
content/articles/YYYY-MM-DD-your-article-slug.md
content/articles/YYYY/MM/your-article-slug/index.md
```

4. Use this front matter template:
Expand All @@ -32,6 +32,7 @@ If you're not comfortable with Git, you can pitch or submit your article through
authors:
- Your Name
date: "YYYY-MM-DDT00:00:00+00:00"
url: /articles/YYYY-MM-DD-your-article-slug/
categories:
- Category Name
tags:
Expand All @@ -42,10 +43,12 @@ If you're not comfortable with Git, you can pitch or submit your article through
Your article content in Markdown goes here.
```

> Tip: If you have the [Front Matter CMS](https://frontmatter.codes/) extension
> installed in VS Code, run **"Create content"** in the `content/articles`
> folder — it scaffolds the file name (`YYYY-MM-DD-slug.md`) and all of the
> front matter fields above for you.
> Tip: create a new Article with Hugo from the repository root. Set `$slug` to a lowercase, hyphenated title, then replace the generated front matter values:
>
> ```powershell
> $date = Get-Date
> hugo new "articles/$($date.ToString('yyyy'))/$($date.ToString('MM'))/$slug/index.md"
> ```

5. Submit a pull request with a brief description of your article

Expand Down
1 change: 1 addition & 0 deletions archetypes/articles.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ author: ""
authors:
- ""
date: '{{ .Date }}'
url: '/articles/{{ .Date.Format "2006-01-02" }}-{{ .File.ContentBaseName }}/'
categories: []
tags: []
draft: true
Expand Down
Loading