Skip to content

Transition sidebar to astro #17

@zastrowm

Description

@zastrowm

Overview

Transition the sidebar and navbar configuration from mkdocs.yml to a new Astro-native YAML configuration file. This will complete the migration from MkDocs to Astro/Starlight by removing the legacy dependency on mkdocs.yml.

Background

The repository has transitioned from MkDocs to Astro/Starlight, but the sidebar navigation is still being read from mkdocs.yml via src/sidebar.ts. The top-nav is separately configured in src/config/navbar.ts. This task consolidates both into a single, cleaner YAML configuration.


Implementation Requirements

1. Create New Configuration File

File: src/config/navigation.yml

Create a new YAML configuration that combines:

  • Navbar links (currently in src/config/navbar.ts)
  • Sidebar structure (currently in mkdocs.yml nav section)
  • GitHub dropdown sections (currently in src/config/navbar.ts)

Simplified structure (files only need slugs, not labels - labels come from frontmatter):

navbar:
  - label: Home
    href: /
  - label: User Guide
    href: /docs/user-guide/quickstart/overview/
    basePath: /docs/user-guide/
  - label: Examples
    href: /docs/examples/
    basePath: /docs/examples/
  # ... remaining nav items

sidebar:
  - label: User Guide
    items:
      - docs/index  # slug only - label from frontmatter
      - label: Quickstart
        items:
          - docs/user-guide/quickstart/overview
          - docs/user-guide/quickstart/python
          - docs/user-guide/quickstart/typescript
      - label: Concepts
        items:
          - label: Agents
            items:
              - docs/user-guide/concepts/agents/agent-loop
              # ... etc
      # ... etc
  - label: Examples
    items:
      - docs/examples
      # ... etc
  # ... remaining sidebar sections

github:
  sections:
    - title: SDKs
      links:
        - label: sdk-python
          href: https://github.com/strands-agents/sdk-python
          icon: PY
        - label: sdk-typescript  
          href: https://github.com/strands-agents/sdk-typescript
          icon: TS
    - title: Organizations
      links:
        - label: strands-agents
          href: https://github.com/strands-agents
        - label: strands-labs
          href: https://github.com/strands-labs

2. Update Sidebar Loading Logic

File: src/sidebar.ts

  • Replace loadSidebarFromMkdocs() with loadSidebarFromConfig() (or similar)
  • Read from src/config/navigation.yml instead of mkdocs.yml
  • Simplify conversion logic since badges are no longer in config
  • Remove getCommunityLabeledFiles() and getSidebarLabels() functions (badges now come from frontmatter only)

3. Update Navbar Configuration

File: src/config/navbar.ts

  • Update to read navbar links from navigation.yml
  • Update to read GitHub sections from navigation.yml
  • Keep TypeScript interfaces (NavLink, GitHubSection, etc.)
  • Export processed data for use in Header component

4. Update Astro Config

File: astro.config.mjs

  • Update import to use new sidebar loading function
  • Remove any mkdocs.yml references

5. Update Tests

File: test/sidebar.test.ts

  • Update to test new configuration format
  • Update path references from mkdocs.yml to navigation.yml
  • Remove tests for getCommunityLabeledFiles and getSidebarLabels if those functions are removed
  • Ensure all existing functionality is covered

6. Clean Up Scripts

File: scripts/update-docs.ts

  • Remove MKDOCS_VARIABLES constant (no longer needed)
  • Remove any references to mkdocs.yml
  • Update or remove MKDOCS_PATH constant

7. Delete Legacy File

Delete: mkdocs.yml

Remove the file after all dependencies have been migrated.

8. Update Documentation

Update references to mkdocs.yml in:

  • AGENTS.md - Update directory structure and workflow sections
  • CONTRIBUTING.md - Update "Writing Docs" section
  • README.md - Update "Writing Documentation" section
  • SITE-ARCHITECTURE.md - Update sidebar generation section
  • CMS-TODO.md - Mark this task as complete
  • src/content/docs/community/get-featured.mdx - If applicable

Acceptance Criteria

  • New src/config/navigation.yml file created with combined navbar, sidebar, and GitHub config
  • src/sidebar.ts updated to read from new YAML config
  • src/config/navbar.ts updated to read from new YAML config
  • astro.config.mjs updated with new imports
  • All existing tests pass (npm test)
  • Site builds successfully (npm run build)
  • Sidebar navigation works correctly in dev server (npm run dev)
  • Top-nav/navbar works correctly
  • GitHub dropdown works correctly
  • mkdocs.yml deleted
  • Documentation updated to reflect new configuration approach

Technical Notes

Badge Handling

Badges (like "new", "community") should come only from frontmatter in the markdown files, not from the navigation config. The existing system already supports this via the sidebar.badge frontmatter field.

Label Handling

File entries in the sidebar config only need the slug - labels are automatically pulled from the page's frontmatter title. Only directory/group entries need explicit labels.

Extra Variables

The extra: section from mkdocs.yml (containing docs_repo, sdk_pypi, etc.) is no longer used and should not be migrated.


Files Summary

Action File
Create src/config/navigation.yml
Modify src/sidebar.ts
Modify src/config/navbar.ts
Modify astro.config.mjs
Modify test/sidebar.test.ts
Modify scripts/update-docs.ts
Modify AGENTS.md, CONTRIBUTING.md, README.md, SITE-ARCHITECTURE.md, CMS-TODO.md
Delete mkdocs.yml

Original Request

Right now the sidebar is still configured in yaml from mkdocs even though we've transitioned to astro/starlight.

We should transition to something (yaml or json) more readable and more integrated with astro/starlight.

If possible, consider integrating the top-nav configuration as well, as right now that's a separate file. Once done we should be able to delete the mkdocs.yml file

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions