Skip to content

Remove New Moon theme and implement dynamic tag system#4

Merged
aravindputrevu merged 3 commits into
mainfrom
claude/ui-improvements-tags-cleanup
Jan 5, 2026
Merged

Remove New Moon theme and implement dynamic tag system#4
aravindputrevu merged 3 commits into
mainfrom
claude/ui-improvements-tags-cleanup

Conversation

@aravindputrevu
Copy link
Copy Markdown
Owner

@aravindputrevu aravindputrevu commented Jan 3, 2026

Summary by CodeRabbit

  • New Features

    • Added tag pages—click any post tag to view all related content organized by topic.
  • Style

    • Post tags now display as interactive links with hover effects.
    • Dark mode button includes a tooltip for better usability.
    • Removed a legacy CSS theme that was no longer used.

✏️ Tip: You can customize this high-level summary in your review settings.

- Add tooltip to dark mode toggle button in Nav
- Make blog post tags clickable, linking to /tags/[tag]
- Create dynamic tag pages showing all posts with that tag
- Remove original-author field from package.json

code written with the help of Claude Code
code written with the help of Claude Code
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 3, 2026

Walkthrough

Removed the New Moon theme and its import, added tag navigation and a dynamic tag page, added a tooltip to the dark-mode button, and removed a non-functional package.json metadata field.

Changes

Cohort / File(s) Change Summary
Package Metadata
package.json
Removed top-level original-author property; no other metadata, deps, scripts, or engines changed.
Dark Mode UX
src/components/astro/Nav.astro
Added title="Toggle dark mode" to the dark-mode button (accessibility/tooltip only; no click logic changes).
Theme Removal
src/layouts/BaseLayout.astro, src/new-moon.css
Deleted src/new-moon.css and removed its import from BaseLayout.astro; all theme and syntax-highlight rules removed.
Tag Display
src/pages/[...slug].astro
Changed tag rendering from <span> to <a href="/tags/{tag.toLowerCase()}"> and added .tag styles (hover background/opacity).
Dynamic Tag Pages
src/pages/tags/[tag].astro
Added new dynamic route with getStaticPaths() that aggregates tags from posts/guides, filters content by tag (case-insensitive), sorts by date (newest first), and renders a tag view with count, entries, and back link.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • Migrate blog from Gatsby to Astro #3 — Related migration touching the same layout/nav and theming assets (BaseLayout.astro, Nav.astro, new-moon.css); likely overlapping theme/dark-mode changes.

Poem

✨ A theme drifts off into the night,
Tags become doors and links take flight,
A button whispers "toggle" with gentle light,
One field removed — the app stays bright. 🪄

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the two main changes: removing the New Moon CSS theme and implementing a dynamic tag system with routing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch claude/ui-improvements-tags-cleanup

📜 Recent review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between ff3db77 and 8f79627.

📒 Files selected for processing (1)
  • src/pages/tags/[tag].astro
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/pages/tags/[tag].astro

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot changed the title @coderabbitai Remove New Moon theme and implement dynamic tag system Jan 3, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/pages/tags/[tag].astro (2)

5-39: Refactor to avoid duplicate data fetching.

Hey friend! I'm seeing a performance opportunity here. You're fetching posts and guides twice - once in getStaticPaths (lines 6-7) and again in the component body (lines 27-28).

While Astro handles this at build time (not runtime), it still means you're re-fetching and re-filtering the entire collection for every tag page. If you have 20 tags, that's 20 unnecessary collection fetches!

The more elegant approach: do the filtering once in getStaticPaths and pass the filtered content through props. This is exactly what props are for!

🔎 Refactored approach with filtered content in props
 export async function getStaticPaths() {
   const posts = await getCollection('posts', ({ data }) => !data.hidden);
   const guides = await getCollection('guides');
+  const allContent = [...posts, ...guides];

   // Collect all unique tags
   const allTags = new Set<string>();
-  [...posts, ...guides].forEach(entry => {
+  allContent.forEach(entry => {
     if (entry.data.tags) {
       entry.data.tags.forEach((tag: string) => allTags.add(tag.toLowerCase()));
     }
   });

   // Generate paths for each tag
   return Array.from(allTags).map(tag => ({
     params: { tag },
-    props: { tag }
+    props: { 
+      tag,
+      content: allContent
+        .filter(entry => entry.data.tags?.some((t: string) => t.toLowerCase() === tag))
+        .sort((a, b) => {
+          const dateA = a.data.date ? new Date(a.data.date).getTime() : 0;
+          const dateB = b.data.date ? new Date(b.data.date).getTime() : 0;
+          return dateB - dateA;
+        })
+    }
   }));
 }

-const { tag } = Astro.props;
+const { tag, content: sortedContent } = Astro.props;

-// Get all posts and guides with this tag
-const posts = await getCollection('posts', ({ data }) => !data.hidden);
-const guides = await getCollection('guides');
-
-const allContent = [...posts, ...guides].filter(entry =>
-  entry.data.tags?.some((t: string) => t.toLowerCase() === tag)
-);
-
-// Sort by date (newest first)
-const sortedContent = allContent.sort((a, b) => {
-  const dateA = a.data.date ? new Date(a.data.date).getTime() : 0;
-  const dateB = b.data.date ? new Date(b.data.date).getTime() : 0;
-  return dateB - dateA;
-});

 const displayTag = tag.charAt(0).toUpperCase() + tag.slice(1);

41-41: Consider more sophisticated capitalization for multi-word tags.

Quick heads up! The current capitalization logic (charAt(0).toUpperCase() + tag.slice(1)) works great for single-word tags, but might not handle multi-word tags or acronyms the way you'd want:

  • "machine-learning""Machine-learning" (probably want "Machine-Learning")
  • "api""Api" (probably want "API"`)

Totally works as-is, but if you find yourself with hyphenated tags or acronyms, you might want to revisit this. Could be a future enhancement!

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a271494 and ff3db77.

📒 Files selected for processing (6)
  • package.json
  • src/components/astro/Nav.astro
  • src/layouts/BaseLayout.astro
  • src/new-moon.css
  • src/pages/[...slug].astro
  • src/pages/tags/[tag].astro
💤 Files with no reviewable changes (3)
  • src/layouts/BaseLayout.astro
  • package.json
  • src/new-moon.css
🔇 Additional comments (4)
src/components/astro/Nav.astro (1)

17-17: Awesome accessibility improvement! 🎉

Hey there! Love seeing the title attribute added here. While the aria-label handles screen readers beautifully, this title gives sighted users that nice tooltip on hover. It's a small touch that makes the UX more discoverable. Well done!

src/pages/[...slug].astro (2)

44-44: Nice work making tags navigable! 🚀

This transformation from static spans to clickable links is solid. The toLowerCase() normalization ensures consistency with your tag page routes. Users can now explore content by tag - that's exactly what we want!


85-91: Clean styling with a nice hover effect! 👌

The link styling here is on point. Removing the underline keeps tags looking like tags rather than traditional links, and the hover state gives users that immediate feedback. The fallback for --lighter-background is a nice defensive touch too!

src/pages/tags/[tag].astro (1)

66-131: Solid, semantic styling! 💪

The CSS here is clean and well-organized. You're using:

  • Semantic HTML structure (ul/li)
  • Flexbox for layout
  • CSS custom properties for theming
  • Responsive design with a media query

The spacing, typography, and hover states all look good. Nice work keeping the styles scoped and maintainable!

Move filtering and sorting into getStaticPaths, pass through props.

code written with the help of Claude Code
@aravindputrevu aravindputrevu merged commit b12ff1d into main Jan 5, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant