Skip to content

Commit fb82267

Browse files
committed
Reorganize Articles into date bundles
1 parent fcf348c commit fb82267

2,262 files changed

Lines changed: 83149 additions & 65987 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/add-article.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,15 @@ jobs:
7272
if not slug:
7373
# Title was only punctuation / non-ASCII — fall back to the issue number.
7474
slug = f"article-{os.environ['ISSUE_NUMBER']}"
75-
filename = f"{today.strftime('%Y-%m-%d')}-{slug}.md"
75+
route = f"/articles/{today.strftime('%Y-%m-%d')}-{slug}/"
7676
7777
fm = {
7878
'title': title,
7979
'author': author,
8080
'authors': [author] if author else [],
8181
'date': date_str,
8282
'description': description,
83+
'url': route,
8384
}
8485
if category:
8586
fm['categories'] = [category]
@@ -89,8 +90,8 @@ jobs:
8990
front = yaml.safe_dump(fm, default_flow_style=False, allow_unicode=True, sort_keys=False)
9091
document = '---\n' + front + '---\n\n' + content + '\n'
9192
92-
filepath = f'content/articles/{filename}'
93-
os.makedirs('content/articles', exist_ok=True)
93+
filepath = f"content/articles/{today.strftime('%Y')}/{today.strftime('%m')}/{slug}/index.md"
94+
os.makedirs(os.path.dirname(filepath), exist_ok=True)
9495
with open(filepath, 'w', encoding='utf-8') as f:
9596
f.write(document)
9697

.github/workflows/build.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ jobs:
9797
--minify \
9898
--destination public
9999
100+
- name: Validate Article bundle output
101+
run: npm run validate:articles
102+
100103
- name: Validate iCalendar feed
101104
run: node scripts/validate-calendar.mjs public/calendar/calendar.ics
102105

CONTRIBUTING.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ If you're not comfortable with Git, you can pitch or submit your article through
1616

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

2121
```
22-
content/articles/YYYY-MM-DD-your-article-slug.md
22+
content/articles/YYYY/MM/your-article-slug/index.md
2323
```
2424

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

45-
> Tip: If you have the [Front Matter CMS](https://frontmatter.codes/) extension
46-
> installed in VS Code, run **"Create content"** in the `content/articles`
47-
> folder — it scaffolds the file name (`YYYY-MM-DD-slug.md`) and all of the
48-
> front matter fields above for you.
46+
> 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:
47+
>
48+
> ```powershell
49+
> $date = Get-Date
50+
> hugo new "articles/$($date.ToString('yyyy'))/$($date.ToString('MM'))/$slug/index.md"
51+
> ```
4952
5053
5. Submit a pull request with a brief description of your article
5154

archetypes/articles.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ author: ""
55
authors:
66
- ""
77
date: '{{ .Date }}'
8+
url: '/articles/{{ .Date.Format "2006-01-02" }}-{{ .File.ContentBaseName }}/'
89
categories: []
910
tags: []
1011
draft: true

0 commit comments

Comments
 (0)