Skip to content

Commit a015411

Browse files
authored
feat: add check for summary and update contribution guide (#475)
* feat: add check for summary and update contribution guide * ci: update triggering logic for link checking
1 parent e834efa commit a015411

File tree

5 files changed

+107
-39
lines changed

5 files changed

+107
-39
lines changed
Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check publishing dates
1+
name: Check article details
22

33
on:
44
pull_request:
@@ -12,7 +12,7 @@ env:
1212
TARGET_BRANCH: "main"
1313

1414
jobs:
15-
check-publishing-dates:
15+
check-article-details:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: Checkout PR contents
@@ -66,13 +66,13 @@ jobs:
6666
CURRENT_MONTH=$(date +%m)
6767
6868
if [[ -s temp/no-yyyy-mm.txt ]]; then
69-
echo "Move your article folder(s) to 'content/blog/${CURRENT_YEAR}/${CURRENT_MONTH}/':"
69+
echo "❌ Wrong folder. Move your article folder(s) to 'content/blog/${CURRENT_YEAR}/${CURRENT_MONTH}/':"
7070
cat temp/no-yyyy-mm.txt
7171
error_found=1
7272
fi
7373
7474
if [[ -s temp/incorrect-yyyy-mm.txt ]]; then
75-
echo "Move your article folder(s) to 'content/blog/${CURRENT_YEAR}/${CURRENT_MONTH}/':"
75+
echo "❌ Wrong folder. Move your article folder(s) to 'content/blog/${CURRENT_YEAR}/${CURRENT_MONTH}/':"
7676
cat temp/incorrect-yyyy-mm.txt
7777
error_found=1
7878
fi
@@ -83,21 +83,55 @@ jobs:
8383
if: always()
8484
run: |
8585
error_found=0
86-
8786
today=$(date +%Y-%m-%d)
8887
8988
while IFS= read -r mdfile; do
9089
if [[ -f "$mdfile" ]]; then
9190
post_date=$(awk '/^date:/ {gsub(/["'\''"]/,"",$2); print $2}' "$mdfile")
9291
9392
if [[ ! "$post_date" =~ ^[0-9]{4}-[0-9]{2}-[0-9]{2}$ ]]; then
94-
echo "In '$mdfile' YAML header, make sure the date is in YYYY-MM-DD format."
93+
echo "In '$mdfile': Invalid date format. Use YYYY-MM-DD."
9594
error_found=1
9695
elif [[ "$post_date" < "$today" ]]; then
97-
echo "Once your article in '$mdfile' is approved, make sure the date in its YAML header is not in the past (found: $post_date, today: $today)."
96+
echo "❌ In '$mdfile': Date is in the past. Update the publishing date after the article is approved (found: $post_date, today: $today)."
9897
error_found=1
98+
else
99+
echo "✅ In '$mdfile': Date format is valid and not in the past."
99100
fi
100101
fi
101102
done < temp/index.txt
102103
103104
exit $error_found
105+
106+
- name: Check summaries in index.md files
107+
if: always()
108+
run: |
109+
if [ -f temp/index.txt ]; then
110+
missing_summary=false
111+
placeholder_summary=false
112+
113+
while IFS= read -r file; do
114+
# Extract YAML header from the file
115+
header=$(awk '/^---$/ {flag=flag+1; next} flag==1' "$file" | awk '/^---$/ {exit} {print}')
116+
summary_line=$(echo "$header" | grep '^summary:' || true)
117+
118+
if [ -z "$summary_line" ]; then
119+
echo "❌ Missing summary in $file. Add the summary."
120+
missing_summary=true
121+
else
122+
summary_value=$(echo "$summary_line" | cut -d':' -f2- | xargs)
123+
if [[ "$summary_value" == Replace\ it\ with* ]]; then
124+
echo "❌ Placeholder summary found in $file. Update the summary."
125+
placeholder_summary=true
126+
else
127+
echo "✅ Summary OK in $file"
128+
fi
129+
fi
130+
done < temp/index.txt
131+
132+
if [ "$missing_summary" = true ] || [ "$placeholder_summary" = true ]; then
133+
exit 1
134+
fi
135+
else
136+
echo "✅ No new index.md files to check"
137+
fi

.github/workflows/pr-check-links-caller.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ name: Check links in diffs
22

33
on:
44
pull_request:
5-
branches: [main]
5+
branches:
6+
- main
7+
paths:
8+
- 'content/**'
9+
- 'README.md'
610

711
jobs:
812
check-links:

archetypes/blog.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
title: "{{ replace .Name "-" " " | title }}"
3+
date: "{{ now.Format "2006-01-02" }}"
4+
showAuthor: false
5+
# Add a summary
6+
summary: "Replace it with a brief summary that capture the essence of (1) what the article is about and (2) how the reader will benefit from reading it. For examples, check other article summaries."
7+
# Create your author entry
8+
# - Create your page at `content/authors/<author-name>/_index.md`
9+
# - Add your personal data at `data/authors/<author-name>.json`
10+
# - Add your author name(s) below
11+
authors:
12+
- "author-name"
13+
# Add tags
14+
tags: ["Tag1", "Tag2"]
15+
---

assets/css/custom.css

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
font-size: 0.85rem;
99
}
1010

11-
/* This reduces font in article summaries */
11+
/* This reduces font in article card summaries */
1212
.py-1 {
1313
font-size: 0.85rem;
1414
font-weight: 400;
@@ -20,8 +20,11 @@
2020
line-height: 1.65;
2121
}
2222

23+
/* This sets the style for article summaries */
2324
.article-summary {
25+
font-weight: 700;
2426
font-style: italic;
25-
padding-left: 10px;
26-
border-left: 4px solid #e7352c;
27+
padding-left: 1em;
28+
border-left: 0.25rem solid #e7352c;
29+
margin-top: 1.6em;
2730
}

content/pages/contribution-guide/writing-content/index.md

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,45 +20,57 @@ There are the following prerequisites before you start writing content:
2020

2121
### Create and view an article
2222

23-
See also the official [docs](https://gohugo.io/getting-started/quick-start/#add-content).
23+
To create a new article, determine the path and run
2424

25-
- To create a new article, determine the path and run
26-
```sh
27-
# Blog article
28-
hugo new content blog/YYYY/MM/<article-folder-name>/index.md
29-
# Blog article example
30-
hugo new content blog/2025/04/ulp-lp-core-get-started/index.md
31-
# Non-blog articles (workshops, events etc.)
32-
hugo new content <path>/index.md
33-
```
34-
This assumes that you want to organize the content as a leaf bundle (a single article). For multi-article entries (workshops, etc.), use the [branch bundle](https://gohugo.io/content-management/page-bundles/#comparison).
35-
- To view the changes, in your project folder run
25+
```sh
26+
# Blog article
27+
# (if specified folders don't exist, they will be created)
28+
hugo new content blog/YYYY/MM/<article-folder-name>/index.md
29+
# Blog article example
30+
hugo new content blog/2025/04/ulp-lp-core-get-started/index.md
31+
# Non-blog articles (workshops, events etc.)
32+
hugo new content <path>/index.md
33+
```
34+
35+
See also the official Hugo [docs](https://gohugo.io/getting-started/quick-start/#add-content).
36+
37+
The commands above assume that you want to organize the content as a leaf bundle (a single article). For multi-article entries (workshops, etc.), use the [branch bundle](https://gohugo.io/content-management/page-bundles/#comparison).
38+
39+
To view the changes, in your project folder run
3640
```sh
3741
hugo server
3842
```
3943

40-
### Add youself as an author
44+
### Fill out the blog article header
4145

42-
The default Espressif author is used:
46+
After creating a blog article using `hugo new content blog/...`, go to your article file `index.md` and fill out its YAML header according to the instructions in comments.
4347

44-
- If the author prefers to stay anonymous
45-
- For posts generated by scripts, such as automatic compilations, release notes, and so on
46-
- For articles generated with AI
48+
One of the YAML header parameters is _summary_ --- the article summary that appears just below the article title ([summary example](../../../blog/2025/04/soft-ap-tutorial/ "under-title summary example")) and also in the article card ([card example](../../../blog/ "card summary example")) where articles are listed. On how to write the article summary, check the additional guidelines below.
4749

48-
In other cases, add yourself as an author. For this, do the following:
50+
#### Write an article summary
4951

50-
- Create your author entry
51-
- At `content/authors/<author-name>/_index.md`, create your page
52-
- At `data/authors/<author-name>.json`, add your personal data
52+
Before you begin writing your article, it is a good exercise to summarize in one paragraph:
5353

54-
- Add the following to your article's YAML header
54+
1. The **main topic** of your article (1 or 2 sentences).
55+
2. What **value** it brings to the reader (1 or 2 sentences).
5556

56-
```yaml
57-
showAuthor: false # Hide default Espressif author
58-
authors:
59-
- "<author-name>" # List your name(s)
60-
```
57+
{{< alert icon="eye" >}}
58+
Don't include links in summaries as they are not supported by design. Also, avoid formatting text as it doesn't look good in general.
59+
{{< /alert >}}
60+
61+
This exercise might help you better understand how to structure and write your content. It will also help readers decide if they want to read your article as well as to set expectations.
62+
63+
After you finish writing, revisit your summary to see if it needs any adjustments. You might be surprised by how the focus of your writing can shift during the process without you realizing it.
64+
65+
#### Add youself as an author
66+
67+
The default Espressif author is used:
68+
69+
- If the author prefers to stay anonymous
70+
- For posts generated by scripts, such as automatic compilations, release notes, and so on
71+
- For articles generated with AI
6172

73+
In other cases, add yourself as an author. For this, follow the instructions in the article's YAML header.
6274

6375
## Write the content
6476

@@ -197,7 +209,7 @@ Some explanations:
197209

198210
For a real example, see this [page](../../../blog/build-embedded-swift-application-for-esp32c6/#building-an-example-project).
199211

200-
As you can see, the `tabs` shortcode has **the parameter** `groupId`. It creates association between all tabbed code blocks bearing the same `groupId` on a webpage. Once you choose a certain tab, all associated code blocks will switch to the same tab. It can be useful in tutorials covering multiple operating systems, programming lanugages, etc.
212+
As you can see, the `tabs` shortcode has **the parameter** `groupId`. It creates association between all tabbed code blocks bearing the same `groupId` on a webpage. Once you choose a certain tab, all associated code blocks will switch to the same tab. It can be useful in tutorials covering multiple operating systems, programming languages, etc.
201213

202214
You can also easily **indent a tabbed code block**, by preceding the `tabs` and `tab` shortcodes with the required number of spaces. This is exactly what was [done][indented-tabbed-code-block] in the linked example above.
203215

0 commit comments

Comments
 (0)