Skip to content

Conversation

@lucperkins
Copy link
Member

@lucperkins lucperkins commented Oct 23, 2025

This PR fixes two issues:

1. Broken language selector

image

(notice none of the languages appears selected)

The PR fixes this:

image

2. Quick start pages out of order

image

(this should begin with "1. Get Nix running on your system")

The PR fixes this:

image

@netlify
Copy link

netlify bot commented Oct 23, 2025

Deploy Preview for zero-to-nix ready!

Name Link
🔨 Latest commit 844f45a
🔍 Latest deploy log https://app.netlify.com/projects/zero-to-nix/deploys/68fabfd4fd4eab0009bb1a42
😎 Deploy Preview https://deploy-preview-480--zero-to-nix.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link

coderabbitai bot commented Oct 23, 2025

Walkthrough

A new content-access layer was added at src/content/collections.ts exposing getStartPagesByOrderParam() and getConceptPagesAlphabetical(). Multiple pages and components replaced direct getCollection() calls with these helpers and updated imports/usages accordingly; one MDX class binding was syntactically adjusted.

Changes

Cohort / File(s) Summary
New collection helpers
src/content/collections.ts
Adds getStartPagesByOrderParam() (async, returns start pages sorted by data.order) and getConceptPagesAlphabetical() (returns concepts collection).
Navigation / Pagination
src/components/Navbar.astro, src/components/Pagination.astro
Replace getCollection() imports/calls with getStartPagesByOrderParam() / getConceptPagesAlphabetical() from ../content/collections; adapt mapped results to use path helpers.
MDX small change
src/components/mdx/Languages.astro
Adjusts x-bind:class attribute expression from a single-quoted object string to a template literal expression (no semantic change).
Start pages
src/pages/start/[slug].astro, src/pages/start/index.astro
Replace getCollection("start") with getStartPagesByOrderParam(); update getStaticPaths usage and top-level start page queries.
Concept pages
src/pages/concepts/[slug].astro, src/pages/concepts/index.astro
Replace getCollection("concepts") with getConceptPagesAlphabetical(); update getStaticPaths and related page computations (added satisfies GetStaticPaths on one export).
LLM text endpoints
src/pages/llms.txt.ts, src/pages/llms-full.txt.ts, src/pages/llms-small.txt.ts
Replace getCollection() calls for start and concepts with the new helper functions; update imports accordingly.

Sequence Diagram(s)

sequenceDiagram
    participant Page as Component/Page
    participant Helpers as content/collections
    participant Astro as astro:content

    rect #eef6ff
    Note over Page,Helpers: New flow — centralized helpers
    Page->>Helpers: import getStartPagesByOrderParam/getConceptPagesAlphabetical()
    Helpers->>Astro: getCollection("start") / getCollection("concepts")
    Astro-->>Helpers: raw collection data
    Helpers->>Helpers: optional sort/filter (e.g., sort by data.order)
    Helpers-->>Page: ordered/filtered pages
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • jeffmartens

Poem

🐰 I hopped through files both near and far,
Helpers stitched pages like threads on a yarn,
Start pages ordered, concepts aligned,
A tidy patch left no loose bind. ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "Fix site presentation issues" is related to the actual changes in the pull request, which address two specific presentation fixes: a language selector issue in Languages.astro and page ordering in dropdowns through the new collection helpers. However, the title is overly broad and generic—it uses "presentation issues" without specifying which issues are being fixed, making it vague relative to the concrete fixes mentioned in the PR objectives. A teammate scanning the commit history would understand that presentation problems are being addressed but would lack clarity about the specific nature of the changes (language selector and page ordering).
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-presentation-issues

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link

@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: 3

🧹 Nitpick comments (2)
src/pages/llms-full.txt.ts (1)

1-4: Align helper name with behavior: sort concepts alphabetically at the source

Centralization looks good. However, getConceptPagesAlphabetical() currently returns unsorted concepts; the name implies a title-ascending sort. Sort in the helper to ensure consistent ordering across pages and dropdowns.

Apply in src/content/collections.ts:

 export const getConceptPagesAlphabetical = async () => {
-  return await getCollection("concepts");
+  return (await getCollection("concepts")).sort((a, b) =>
+    a.data.title.localeCompare(b.data.title),
+  );
 };

Also applies to: 23-24

src/pages/start/[slug].astro (1)

34-34: Avoid duplicate fetch for count; use value from getStaticPaths

Use the total passed in props and fall back to a fetch only if needed.

-const numQuickStartPages = (await getStartPagesByOrderParam()).length;
+const numQuickStartPages =
+  Astro.props.total ?? (await getStartPagesByOrderParam()).length;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61ce6ed and 45dd81f.

📒 Files selected for processing (11)
  • src/components/Navbar.astro (1 hunks)
  • src/components/Pagination.astro (1 hunks)
  • src/components/mdx/Languages.astro (1 hunks)
  • src/content/collections.ts (1 hunks)
  • src/pages/concepts/[slug].astro (2 hunks)
  • src/pages/concepts/index.astro (1 hunks)
  • src/pages/llms-full.txt.ts (2 hunks)
  • src/pages/llms-small.txt.ts (2 hunks)
  • src/pages/llms.txt.ts (2 hunks)
  • src/pages/start/[slug].astro (2 hunks)
  • src/pages/start/index.astro (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
src/pages/llms.txt.ts (1)
src/content/collections.ts (2)
  • getStartPagesByOrderParam (3-8)
  • getConceptPagesAlphabetical (10-12)
src/pages/llms-small.txt.ts (1)
src/content/collections.ts (2)
  • getStartPagesByOrderParam (3-8)
  • getConceptPagesAlphabetical (10-12)
src/pages/llms-full.txt.ts (1)
src/content/collections.ts (2)
  • getStartPagesByOrderParam (3-8)
  • getConceptPagesAlphabetical (10-12)
🔇 Additional comments (9)
src/components/mdx/Languages.astro (1)

20-20: LGTM! This fixes the language selector issue.

The change from a single-quoted string to a template literal ensures Alpine.js correctly evaluates the x-bind:class expression. This addresses the language selector issue mentioned in the PR objectives.

src/content/collections.ts (1)

3-8: LGTM! The sorting logic is correct.

The function correctly sorts start pages by the order field in ascending order, addressing the page ordering issue mentioned in the PR objectives.

src/components/Pagination.astro (1)

4-12: LGTM! The migration to the new helper is correct.

The component now uses getStartPagesByOrderParam() to fetch ordered start pages. The pagination logic for finding previous/next pages remains intact and correct.

src/pages/llms-small.txt.ts (1)

1-23: LGTM! The migration to the new collection helpers is correct.

The file correctly uses both getStartPagesByOrderParam() and getConceptPagesAlphabetical() to fetch the respective collections. The template rendering logic remains unchanged.

src/pages/llms.txt.ts (1)

1-4: LGTM! The migration to the new collection helpers is correct.

The file correctly uses both getStartPagesByOrderParam() and getConceptPagesAlphabetical() to fetch the respective collections. The template rendering logic remains unchanged.

Also applies to: 43-44

src/pages/concepts/[slug].astro (1)

18-25: LGTM! The migration to the new helper is correct.

The file correctly uses getConceptPagesAlphabetical() for both getStaticPaths and related concepts resolution. The addition of the satisfies GetStaticPaths type guard improves type safety.

Also applies to: 34-34

src/components/Navbar.astro (1)

9-28: LGTM! The migration to the new collection helpers is correct.

The navbar correctly uses getStartPagesByOrderParam() for start pages and getConceptPagesAlphabetical() for concept pages. The mapping logic to create dropdown items remains intact.

src/pages/start/index.astro (2)

8-8: LGTM on switching to the centralized ordered helper


15-15: The review comment is incorrect; no action needed.

The startPagePath() function already handles the slug format correctly. It internally removes the leading "/" via slug.substring(1) on line 12 of src/lib/utils.ts. The getStartPagesByOrderParam() function returns collection items with slugs that include a leading "/", and startPagePath() is designed to accept this format. All call sites throughout the codebase follow the same pattern of passing the slug directly without additional sanitization, confirming this is the intended behavior.

Likely an incorrect or invalid review comment.

@lucperkins lucperkins merged commit d5ff744 into main Oct 24, 2025
9 checks passed
@lucperkins lucperkins deleted the fix-presentation-issues branch October 24, 2025 04:04
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.

2 participants