├── .changeset ├── README.md └── config.json ├── .github ├── renovate.json └── workflows │ ├── release.yml │ └── renovate.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.cjs ├── CHANGELOG.md ├── README.md ├── index.ts ├── package.json ├── pnpm-lock.yaml ├── src ├── Breadcrumbs.astro ├── Navigation.astro ├── NavigationItem.astro ├── NavigationList.astro ├── Pagination.astro ├── Schema.astro ├── env.d.ts ├── schemas.ts └── utils.ts └── tsconfig.json /.changeset/README.md: -------------------------------------------------------------------------------- 1 | # Changesets 2 | 3 | Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works 4 | with multi-package repos, or single-package repos to help you version and publish your code. You can 5 | find the full documentation for it [in our repository](https://github.com/changesets/changesets) 6 | 7 | We have a quick list of common questions to get you started engaging with this project in 8 | [our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md) 9 | -------------------------------------------------------------------------------- /.changeset/config.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://unpkg.com/@changesets/config@2.1.1/schema.json", 3 | "changelog": ["@changesets/cli/changelog", { "repo": "tony-sull/astro-navigation" }], 4 | "commit": false, 5 | "fixed": [], 6 | "linked": [], 7 | "access": "public", 8 | "baseBranch": "main", 9 | "updateInternalDependencies": "patch", 10 | "ignore": [] 11 | } 12 | -------------------------------------------------------------------------------- /.github/renovate.json: -------------------------------------------------------------------------------- 1 | { 2 | "branchPrefix": "renovate/", 3 | "dryRun": true, 4 | "username": "renovate-release", 5 | "gitAuthor": "Renovate Bot ", 6 | "platform": "github" 7 | } 8 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'main' 7 | pull_request: 8 | paths-ignore: 9 | - '.vscode/**' 10 | 11 | # Automatically cancel in-progress actions on the same branch 12 | concurrency: 13 | group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} 14 | cancel-in-progress: true 15 | 16 | defaults: 17 | run: 18 | shell: bash 19 | 20 | jobs: 21 | # Lint can run in parallel with Build. 22 | # We also run `yarn install` with the `--prefer-offline` flag to speed things up. 23 | # Lint can run in parallel with Build. 24 | # We also run `yarn install` with the `--prefer-offline` flag to speed things up. 25 | lint: 26 | name: Lint 27 | runs-on: ubuntu-latest 28 | steps: 29 | - name: Check out repository 30 | uses: actions/checkout@v3 31 | 32 | - name: Setup PNPM 33 | uses: pnpm/action-setup@v2.2.1 34 | 35 | - name: Setup Node 36 | uses: actions/setup-node@v3 37 | with: 38 | node-version: 16 39 | cache: 'pnpm' 40 | 41 | - name: Install dependencies 42 | run: pnpm install 43 | 44 | - name: Status 45 | run: git status 46 | 47 | # Lint autofix cannot run on forks, so just skip those! See https://github.com/wearerequired/lint-action/issues/13 48 | - name: Lint (External) 49 | if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }} 50 | run: pnpm lint 51 | 52 | # Otherwise, run lint autofixer 53 | - name: Lint 54 | if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.repository_owner }} 55 | uses: wearerequired/lint-action@v1.10.0 56 | env: 57 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 58 | with: 59 | prettier: true 60 | auto_fix: true 61 | git_name: github-actions[bot] 62 | git_email: github-actions[bot]@users.noreply.github.com 63 | commit_message: 'chore(lint): ${linter} fix' 64 | github_token: ${{ secrets.GITHUB_TOKEN }} 65 | neutral_check_on_warning: true 66 | 67 | # Changelog can only run _after_ Build and Test. 68 | # We download all `dist/` artifacts from GitHub to skip the build process. 69 | changelog: 70 | name: Changelog PR or Release 71 | if: ${{ github.ref_name == 'main' }} 72 | needs: [lint] 73 | runs-on: ubuntu-latest 74 | steps: 75 | - uses: actions/checkout@v3 76 | 77 | - name: Setup PNPM 78 | uses: pnpm/action-setup@v2.2.1 79 | 80 | - name: Setup Node 81 | uses: actions/setup-node@v3 82 | with: 83 | node-version: 16 84 | cache: 'pnpm' 85 | env: 86 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 87 | 88 | - name: Install dependencies 89 | run: pnpm install 90 | 91 | - name: Create Release Pull Request or Publish 92 | id: changesets 93 | uses: changesets/action@v1 94 | with: 95 | publish: pnpm exec changeset publish 96 | commit: '[ci] release' 97 | title: '[ci] release' 98 | env: 99 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 100 | NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 101 | -------------------------------------------------------------------------------- /.github/workflows/renovate.yml: -------------------------------------------------------------------------------- 1 | name: Renovate 2 | on: 3 | schedule: 4 | # The "*" (#42, asterisk) character has special semantics in YAML, so this 5 | # string has to be quoted. 6 | - cron: '0/15 * * * *' 7 | jobs: 8 | renovate: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v2.0.0 13 | - name: Self-hosted Renovate 14 | uses: renovatebot/github-action@v32.118.0 15 | with: 16 | configurationFile: .github/renovate.json 17 | token: ${{ secrets.GITHUB_TOKEN }} 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # build output 2 | dist/ 3 | 4 | # dependencies 5 | node_modules/ 6 | 7 | # logs 8 | npm-debug.log* 9 | yarn-debug.log* 10 | yarn-error.log* 11 | pnpm-debug.log* 12 | 13 | 14 | # environment variables 15 | .env 16 | .env.production 17 | 18 | # macOS-specific files 19 | .DS_Store 20 | 21 | # Local Netlify folder 22 | .netlify 23 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | .vscode 2 | pnpm-lock.yaml 3 | dist 4 | node_modules -------------------------------------------------------------------------------- /.prettierrc.cjs: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [require.resolve('prettier-plugin-astro')], 3 | printWidth: 120, 4 | semi: false, 5 | singleQuote: true, 6 | overrides: [ 7 | { 8 | files: '*.astro', 9 | options: { 10 | parser: 'astro', 11 | }, 12 | }, 13 | ], 14 | } 15 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # astro-navigation 2 | 3 | ## 0.4.0 4 | 5 | ### Minor Changes 6 | 7 | - 384f316: Upgrades to the latest version of Astro and uses the new astro/types interfaces 8 | 9 | ### Patch Changes 10 | 11 | - fbd6bb8: Fixing formatting error of readme file in npm 12 | 13 | ## 0.3.0 14 | 15 | ### Minor Changes 16 | 17 | - a4f11af: feat: adds support for .astro pages :rocket: 18 | 19 | ## 0.2.1 20 | 21 | ### Patch Changes 22 | 23 | - f5192e2: fix: fixes dependency graph 24 | 25 | ## 0.2.0 26 | 27 | ### Minor Changes 28 | 29 | - 3b7ca3d: fixes a mismatch between "name" and "title" frontmatter naming. 30 | 31 | ### Patch Changes 32 | 33 | - ee4fd2b: chore: linter fixes 34 | - 51c0395: `@type` is now defaulted to "WebPage" when not provided in a page's frontmatter 35 | - d44cff3: Fixes a link in the package.json metadata 36 | - 881aef2: fix: navigation.permalink frontmatter was being ignored 37 | 38 | ## 0.1.2 39 | 40 | ### Patch Changes 41 | 42 | - 0f8d703: Updates package metadata for NPM deployments 43 | 44 | ## 0.1.1 45 | 46 | ### Patch Changes 47 | 48 | - 1e98d8a: Always include the WebPage ld+json schema in 49 | 50 | ## 0.1.0 51 | 52 | ### Minor Changes 53 | 54 | - 21ec11c: Updates the components to handle globbing `/src/content/pages` internally, no more passing your own `Astro.glob()` results! 55 | - e1076b9: Adds a new `` component for next/previous links 56 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # astro-navigation 2 | 3 | A plugin for creating hierarchical navigation in Astro projects. Supports breadcrumbs and next/previous pagination too! 4 | 5 | > Full docs coming soon! 6 | 7 | ## Basic usage 8 | 9 | This packages adds three components useful for building hierarchical navigation in [Astro](https://astro.build). Just write your Markdown and MDX pages in `src/content/pages` and you're all set! 10 | 11 | `` builds a sorted hierarchical navigation menu, `` adds an SEO-friendly breadcrumb list for the current page, and `` adds next/previous navigation links. 12 | 13 | ## `` component 14 | 15 | This is the main component, building the HTML for a sorted navigation menu. Include a bit of frontmatter on each `.md` or `.mdx` page and the component will handle sorting and nesting pages automatically. 16 | 17 | The `` component will build the list itself but leaves rendering a `