Skip to content

Commit 1d21acc

Browse files
authored
Update main.yml
1 parent 5db61ed commit 1d21acc

1 file changed

Lines changed: 35 additions & 13 deletions

File tree

.github/workflows/main.yml

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,53 @@ jobs:
2323
with:
2424
submodules: true
2525

26-
- name: Generate index.html (root)
26+
- name: Generate index.html (root, denylist)
2727
shell: bash
2828
run: |
2929
set -euo pipefail
30+
31+
# Denylist of top-level directories to exclude from the talks index.
32+
# Also skip any dir starting with "_" or ".".
33+
SKIP_RE='^(reveal|reveal\.js|\.git|\.github|node_modules|vendor|assets|theme|dist|plugin|scripts|tools|test|tests|ci)$'
34+
3035
cat > index.html <<'HTML'
3136
<!doctype html><html lang="en"><head><meta charset="utf-8">
37+
<meta name="viewport" content="width=device-width, initial-scale=1">
3238
<title>My Talks</title>
3339
<style>
34-
body { font-family: system-ui, sans-serif; max-width: 50rem; margin: 2rem auto; padding: 0 1rem; }
35-
h1 { margin: 0 0 1rem; }
36-
ul { list-style: none; padding: 0; }
37-
li { margin: .4rem 0; }
38-
a { text-decoration: none; color: #1565c0; font-weight: 500; }
40+
:root { color-scheme: light dark; }
41+
body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; max-width: 50rem; margin: 2rem auto; padding: 0 1rem; line-height: 1.6; }
42+
h1 { margin: 0 0 1rem; font-size: 1.75rem; }
43+
ul { list-style: none; padding: 0; margin: 0; }
44+
li { margin: .5rem 0; }
45+
a { text-decoration: none; color: #1565c0; font-weight: 600; }
3946
a:hover { text-decoration: underline; }
40-
</style></head><body><h1>My Talks</h1><ul>
47+
</style></head><body>
48+
<h1>My Talks</h1>
49+
<ul>
4150
HTML
51+
52+
# List only first-level dirs that contain index.html and are not denied.
4253
for d in */ ; do
43-
if [ -f "${d}index.html" ]; then
44-
name="${d%/}"
45-
title=$(grep -m1 -oP '(?i)(?<=<title>).*?(?=</title>)' "${d}index.html" || true)
46-
[ -n "$title" ] || title="$name"
47-
printf '<li><a href="%s/">%s</a></li>\n' "$name" "$title" >> index.html
54+
[ -f "${d}index.html" ] || continue
55+
name="${d%/}"
56+
57+
# Denylist checks
58+
if [[ "$name" =~ $SKIP_RE ]] || [[ "$name" == _* ]] || [[ "$name" == .* ]]; then
59+
continue
4860
fi
61+
62+
# Extract <title> (fallback to folder name)
63+
title="$(grep -m1 -i '<title>' "${d}index.html" | sed -E 's:.*<title>(.*)</title>.*:\1:i' || true)"
64+
[ -n "$title" ] || title="$name"
65+
66+
printf ' <li><a href="%s/">%s</a></li>\n' "$name" "$title" >> index.html
4967
done
50-
echo '</ul></body></html>' >> index.html
68+
69+
cat >> index.html <<'HTML'
70+
</ul>
71+
</body></html>
72+
HTML
5173
5274
- name: Setup Pages
5375
uses: actions/configure-pages@v4

0 commit comments

Comments
 (0)