Repository navigation
Feat/new badge - #7183
Open
eli32-vlc wants to merge 4 commits into
Open
Feat/new badge#7183eli32-vlc wants to merge 4 commits into
eli32-vlc wants to merge 4 commits into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Auto-expiring NEW badge for entries added in the last 7 days
Adds a small NEW pill next to wiki entries added in the last 7 days, so people browsing a page can spot new additions without checking Discord. The pill disappears on its own after a week.
How it works
• No manual work. scripts/generate-removed.js already walks the last 30 days of git history for the Recently Removed page. It now also records primary resources added in the last 7 days and writes docs/.vitepress/new-sites.json (URL to date added, gitignored).
• Only real additions count. A URL is marked new only if it's still on the wiki, wasn't removed anywhere in the 30-day window, and no entry with the same name was removed in the same commit. Section moves, re-adds and URL swaps don't get the badge.
• Rendering. The existing list_item_open rule in markdown/toggleStarred.ts adds a "new" class and a badge span when an item's first link is in that file. The markdown source isn't touched, so single-page, the API and the backups are unaffected.
• Styling. A rounded pill, dark grey with white text in dark mode and light grey with dark text in light mode. The "NEW" text comes from CSS, so it doesn't show up in search results or copied text. Hovering shows the date added (for example "Added Nov 9"), which is also the aria-label.
• Expiry. Badges drop off on the first build after 7 days. Pages rebuild on every push, so in practice that's near-daily.
Why a pill
A sparkle is too easy to confuse with starred entries, a plus or circle looks like a button, and a highlighted row clashes with starred entries and search matches. A plain NEW label is the most widely recognised.