Skip to content

Commit fcdd312

Browse files
committed
Added cards to show latest announcements in cards on the starting page.
Added pinned indicator on the index page cards
1 parent 8f89968 commit fcdd312

5 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ How it works:
5050

5151
Controlling what is shown:
5252

53-
- To keep a post on the home page, add `pin: true` to its front matter. It also stays at the top of the Announcements page. Remove the flag when it should drop off.
53+
- To keep a post on the home page, add `pin: true` to its front matter. Its card is shown first with the same pin badge as on the Announcements page, and the post also stays at the top of the Announcements page. Pinned posts count towards `COUNT`. Remove the flag when it should drop off.
5454
- To control the card text, add a `description:` to the post front matter.
5555
- The number of cards (`COUNT`), summary length (`SUMMARY_LENGTH`) and category icons (`ICONS`) are set at the top of [hooks/latest_posts.py](hooks/latest_posts.py). Icons use the [Material icon](https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/) shortcode syntax.
5656

‎docs/announcements/posts/2026/2026-08-14-next-chapter-for-utPLSQL.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ date:
55
created: 2026-08-12
66
categories:
77
- "news"
8+
pin: true
89
---
910

1011
## Looking back

‎docs/announcements/posts/2026/2026-09-25_incorporation_of_utPLSQL.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ date:
55
created: 2026-09-25
66
categories:
77
- "news"
8+
pin: true
89
---
910

1011
# Incorporation of utPLSQL

‎docs/stylesheets/extra.css‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,9 @@
4040
[data-md-color-scheme="slate"] .latest-posts__more {
4141
color: var(--md-primary-fg-color);
4242
}
43+
44+
/* Material's pin badge (md-pin) is a flex item on the Announcements page - align it inline here */
45+
.latest-posts__meta .md-pin {
46+
display: inline-block;
47+
vertical-align: middle;
48+
}

‎hooks/latest_posts.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,12 @@ def _card(post, link):
7575
icon = next((ICONS[c] for c in categories if c in ICONS), DEFAULT_ICON)
7676
created = post.config.date.created
7777
date = f"{created:%B} {created.day}, {created.year}"
78+
# Same pin badge as on the Announcements page (Material's `md-pin`)
79+
pin = '<span class="md-pin"></span> · ' if post.config.pin else ""
7880
return (
7981
f"- {icon}{{ .lg .middle }} __[{post.meta['title']}]({link})__\n\n"
8082
f" ---\n\n"
81-
f' <span class="latest-posts__meta">{date} · {" · ".join(categories)}</span>\n\n'
83+
f' <span class="latest-posts__meta">{pin}{date} · {" · ".join(categories)}</span>\n\n'
8284
f" {_summary(post)}\n\n"
8385
f' <span class="latest-posts__more">Read more :octicons-arrow-right-24:</span>\n'
8486
)

0 commit comments

Comments
 (0)