diff --git a/content/advanced/index.md b/content/advanced/index.md index d2d5af2..7000595 100644 --- a/content/advanced/index.md +++ b/content/advanced/index.md @@ -12,23 +12,4 @@ the more advanced features of Codeberg. See also the [documentation of Forgejo](https://forgejo.org/docs/), the software which Codeberg is based on. -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} diff --git a/content/codeberg-pages/index.md b/content/codeberg-pages/index.md index 4dd54c1..34a59a4 100644 --- a/content/codeberg-pages/index.md +++ b/content/codeberg-pages/index.md @@ -34,26 +34,7 @@ See also: - [codeberg.page](https://codeberg.page) - [Troubleshooting (Codeberg Documentation)](troubleshooting) -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} ## Getting started with a `codeberg.page` URL diff --git a/content/codeberg-translate/index.md b/content/codeberg-translate/index.md index 94c4652..37a9912 100644 --- a/content/codeberg-translate/index.md +++ b/content/codeberg-translate/index.md @@ -9,23 +9,4 @@ description: These articles shows you how to use Codeberg Translate These documentation pages contain information on how you can use [Codeberg Translate](https://translate.codeberg.org) -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} diff --git a/content/collaborating/index.md b/content/collaborating/index.md index cac985c..e6f3bda 100644 --- a/content/collaborating/index.md +++ b/content/collaborating/index.md @@ -13,23 +13,4 @@ If you're new to Codeberg or software forges in general, please also have a look our [Getting Started Guide](/getting-started) which will teach you the basics of issue tracking and wikis on Codeberg. -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} diff --git a/content/getting-started/index.md b/content/getting-started/index.md index 0b9b815..5ddf655 100644 --- a/content/getting-started/index.md +++ b/content/getting-started/index.md @@ -24,23 +24,4 @@ You can start with [finding out more about Codeberg](/getting-started/what-is-co Welcome to Codeberg! 😊 -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} diff --git a/content/git/index.md b/content/git/index.md index c9e3b41..dad8ca0 100644 --- a/content/git/index.md +++ b/content/git/index.md @@ -19,23 +19,4 @@ We recommend the use of the [SSH protocol](https://en.wikipedia.org/wiki/Secure_ It offers improved security through key-based access (stronger protection than a regular password) and better ease of use (no need to provide credentials on every push). -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} diff --git a/content/improving-documentation/index.md b/content/improving-documentation/index.md index 546a5e1..b97a82f 100644 --- a/content/improving-documentation/index.md +++ b/content/improving-documentation/index.md @@ -8,26 +8,7 @@ eleventyNavigation: We're very happy you're considering to contribute to Codeberg Documentation! -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} ## How do I contribute to Codeberg Documentation? diff --git a/content/integrations/index.md b/content/integrations/index.md index 9436791..18fa300 100644 --- a/content/integrations/index.md +++ b/content/integrations/index.md @@ -13,23 +13,4 @@ ecosystem of Forgejo instances. Can can also see [awesome-gitea](https://gitea.com/gitea/awesome-gitea/src/README.md), most of the Gitea-specific solutions should work with our Forgejo instance, too. -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} diff --git a/content/markdown/index.md b/content/markdown/index.md index d522113..b353dfa 100644 --- a/content/markdown/index.md +++ b/content/markdown/index.md @@ -23,23 +23,4 @@ look them up and learn more about Markdown. - [English Wikipedia article on Markdown](https://en.wikipedia.org/wiki/Markdown) - [The Markdown Guide](https://www.markdownguide.org/) -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} diff --git a/content/security/index.md b/content/security/index.md index 418e236..3535c6f 100644 --- a/content/security/index.md +++ b/content/security/index.md @@ -8,23 +8,4 @@ eleventyNavigation: This section contains information on how to securely use Codeberg. -{% assign navPages = collections.all | eleventyNavigation %} -{%- for entry in navPages %} -{% if entry.url == page.url %} -{%- if entry.children.length -%} - - - - - - - {%- for child in entry.children %} - - - - {%- endfor %} - -
Find out more in this section:
{{ child.title }}
-{% endif %} -{% endif %} -{%- endfor %} +{% sectionNav collections %} diff --git a/eleventy.config.mjs b/eleventy.config.mjs index c46e94c..b7b3fe3 100644 --- a/eleventy.config.mjs +++ b/eleventy.config.mjs @@ -82,6 +82,28 @@ export default function (eleventyConfig) { }, }); + // the article list navigation for section index pages + eleventyConfig.addShortcode('sectionNav', function (collections) { + const navFilter = eleventyConfig.getFilter('eleventyNavigation'); + + // from the nav tree, find the current page's entry + const entry = navFilter(collections.all).find(page => page.url == this.page.url); + + // if the current page has children, create a nav table with a link for each + if (entry.children.length) { + const rows = entry.children.map(child => + `${ child.title }` + ).join(''); + + return ` + + + + ${rows} +
Find out more in this section:
`; + } + }); + eleventyConfig.on('eleventy.after', () => { execSync(`npx pagefind`, { encoding: 'utf-8' }); }); diff --git a/package.json b/package.json index 46320a0..2bf807a 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "lint-spellcheck": "cspell lint --no-progress --gitignore '{**,.*}/{*,.*}'" }, "devDependencies": { - "@11ty/eleventy": "3.1.2", + "@11ty/eleventy": "3.1.5", "@11ty/eleventy-img": "6.0.4", "@11ty/eleventy-navigation": "1.0.5", "@11ty/eleventy-plugin-syntaxhighlight": "5.0.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e64ee76..c937a91 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: devDependencies: '@11ty/eleventy': - specifier: 3.1.2 - version: 3.1.2 + specifier: 3.1.5 + version: 3.1.5 '@11ty/eleventy-img': specifier: 6.0.4 version: 6.0.4 @@ -56,11 +56,11 @@ importers: packages: - '@11ty/dependency-tree-esm@2.0.2': - resolution: {integrity: sha512-kSTmXneksQLBhwsfqjxiSi9ecRKENXmRtT5RG95rFoWSI8kkwLcGlYpoXsPkCD9uQwSU1rmDzXBDnqUJlWaIyw==} + '@11ty/dependency-tree-esm@2.0.4': + resolution: {integrity: sha512-MYKC0Ac77ILr1HnRJalzKDlb9Z8To3kXQCltx299pUXXUFtJ1RIONtULlknknqW8cLe19DLVgmxVCtjEFm7h0A==} - '@11ty/dependency-tree@4.0.0': - resolution: {integrity: sha512-PTOnwM8Xt+GdJmwRKg4pZ8EKAgGoK7pedZBfNSOChXu8MYk2FdEsxdJYecX4t62owpGw3xK60q9TQv/5JI59jw==} + '@11ty/dependency-tree@4.0.2': + resolution: {integrity: sha512-RTF6VTZHatYf7fSZBUN3RKwiUeJh5dhWV61gDPrHhQF2/gzruAkYz8yXuvGLx3w3ZBKreGrR+MfYpSVkdbdbLA==} '@11ty/eleventy-dev-server@2.0.8': resolution: {integrity: sha512-15oC5M1DQlCaOMUq4limKRYmWiGecDaGwryr7fTE/oM9Ix8siqMvWi+I8VjsfrGr+iViDvWcH/TVI6D12d93mA==} @@ -89,8 +89,8 @@ packages: resolution: {integrity: sha512-6QE+duqSQ0GY9rENXYb4iPR4AYGdrFpqnmi59tFp9VrleOl0QSh8VlBr2yd6dlhkdtj7904poZW5PvGr9cMiJQ==} engines: {node: '>=18'} - '@11ty/eleventy@3.1.2': - resolution: {integrity: sha512-IcsDlbXnBf8cHzbM1YBv3JcTyLB35EK88QexmVyFdVJVgUU6bh9g687rpxryJirHzo06PuwnYaEEdVZQfIgRGg==} + '@11ty/eleventy@3.1.5': + resolution: {integrity: sha512-hZ0g6MwZyRxCqXsPm82gIM304LraKbUz3ZmezOSjsqxttZG6cHTib3Qq8QkESJoKwnr+yX1eyfOkPC5/mEgZnQ==} engines: {node: '>=18'} hasBin: true @@ -98,12 +98,12 @@ packages: resolution: {integrity: sha512-Mqt6im1xpb1Ykn3nbcCovWXK3ggywRJa+IXIdoz4wIIK+cvozADH63lexcuPpGS/gJ6/m2JxyyXDyupkMr5DHw==} engines: {node: '>=14'} - '@11ty/posthtml-urls@1.0.1': - resolution: {integrity: sha512-6EFN/yYSxC/OzYXpq4gXDyDMlX/W+2MgCvvoxf11X1z76bqkqFJ8eep5RiBWfGT5j0323a1pwpelcJJdR46MCw==} + '@11ty/posthtml-urls@1.0.3': + resolution: {integrity: sha512-1YvhnkaNlFnnJic1rBMWmTC2adbuy+JQiBfl1Hecr1Wjjik1pQZmGyk/eC9zKX/FQv52s2Nht1Gi/UwhYqrBeg==} engines: {node: '>= 6'} - '@11ty/recursive-copy@4.0.2': - resolution: {integrity: sha512-174nFXxL/6KcYbLYpra+q3nDbfKxLxRTNVY1atq2M1pYYiPfHse++3IFNl8mjPFsd7y2qQjxLORzIjHMjL3NDQ==} + '@11ty/recursive-copy@4.0.4': + resolution: {integrity: sha512-oI7m8pa7/IAU/3lqRU9vjBbs20iKFo7x+1K9kT3aVira6scc1X9MjBdgLCHzLJeJ7iB6wydioA+kr9/qPnvmlQ==} engines: {node: '>=18'} '@cspell/cspell-bundled-dicts@9.8.0': @@ -588,25 +588,9 @@ packages: argparse@2.0.1: resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==} - array-differ@1.0.0: - resolution: {integrity: sha512-LeZY+DZDRnvP7eMuQ6LHfCzUGxAAIViUBliK24P3hWXL6y4SortgR6Nim6xrkfSLlmH0+k+9NYNwVC2s53ZrYQ==} - engines: {node: '>=0.10.0'} - array-timsort@1.0.3: resolution: {integrity: sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==} - array-union@1.0.2: - resolution: {integrity: sha512-Dxr6QJj/RdU/hCaBjOfxW+q6lyuVE6JFWIrAUpuOOhoJJoQ99cUn3igRaHVB5P9WrgFVN0FfArM3x0cueOU8ng==} - engines: {node: '>=0.10.0'} - - array-uniq@1.0.3: - resolution: {integrity: sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==} - engines: {node: '>=0.10.0'} - - arrify@1.0.1: - resolution: {integrity: sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==} - engines: {node: '>=0.10.0'} - asap@2.0.6: resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} @@ -1094,8 +1078,8 @@ packages: linkify-it@5.0.0: resolution: {integrity: sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==} - liquidjs@10.24.0: - resolution: {integrity: sha512-TAUNAdgwaAXjjcUFuYVJm9kOVH7zc0mTKxsG9t9Lu4qdWjB2BEblyVIYpjWcmJLMGgiYqnGNJjpNMHx0gp/46A==} + liquidjs@10.25.7: + resolution: {integrity: sha512-rPCjJLiD4eDhQjvv964AeXFC+HbeYBbZrd7Z82Q6hqv1lX7G+5w4SJcKLn9CAAAwHI4aS3dTdo083UB79K3pDA==} engines: {node: '>=16'} hasBin: true @@ -1134,10 +1118,6 @@ packages: resolution: {integrity: sha512-UKybllYNheWac61Ia7T6fzuQNDZimFIpCg2w6hHjgV1Qu0w1TV0LlSgryUGzM0bkKQCBhy2FDhEELB73Kb0kAg==} engines: {node: '>=20'} - maximatch@0.1.0: - resolution: {integrity: sha512-9ORVtDUFk4u/NFfo0vG/ND/z7UQCVZBL539YW0+U1I7H1BkZwizcPx5foFv7LCPcBnm2U6RjFnQOsIvN4/Vm2A==} - engines: {node: '>=0.10.0'} - mdn-data@2.0.28: resolution: {integrity: sha512-aylIc7Z9y4yzHYAJNuESG3hfhC+0Ibp/MAMiaOZgNv4pmEdFyfZhhhny4MNiAfWdBQ1RQ2mfDWmM1x8SvGyp8g==} @@ -1240,8 +1220,8 @@ packages: engines: {node: '>=10.0.0'} hasBin: true - minimatch@3.1.2: - resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} + minimatch@3.1.5: + resolution: {integrity: sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==} minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} @@ -1455,8 +1435,8 @@ packages: resolution: {integrity: sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==} engines: {node: '>=14.16'} - slugify@1.6.6: - resolution: {integrity: sha512-h+z7HKHYXj6wJU+AnS/+IH8Uh9fdcX1Lrhg1/VMdf9PwoBQXFcXiAdsy2tSK0P6gKwJLXp02r90ahUCqHk9rrw==} + slugify@1.6.9: + resolution: {integrity: sha512-vZ7rfeehZui7wQs438JXBckYLkIIdfHOXsaVEUMyS5fHo1483l1bMdo0EDSWYclY0yZKFOipDy4KHuKs6ssvdg==} engines: {node: '>=8.0.0'} smol-toml@1.6.1: @@ -1556,14 +1536,14 @@ packages: snapshots: - '@11ty/dependency-tree-esm@2.0.2': + '@11ty/dependency-tree-esm@2.0.4': dependencies: '@11ty/eleventy-utils': 2.0.7 acorn: 8.15.0 dependency-graph: 1.0.0 normalize-path: 3.0.0 - '@11ty/dependency-tree@4.0.0': + '@11ty/dependency-tree@4.0.2': dependencies: '@11ty/eleventy-utils': 2.0.7 @@ -1628,16 +1608,16 @@ snapshots: '@11ty/eleventy-utils@2.0.7': {} - '@11ty/eleventy@3.1.2': + '@11ty/eleventy@3.1.5': dependencies: - '@11ty/dependency-tree': 4.0.0 - '@11ty/dependency-tree-esm': 2.0.2 + '@11ty/dependency-tree': 4.0.2 + '@11ty/dependency-tree-esm': 2.0.4 '@11ty/eleventy-dev-server': 2.0.8 '@11ty/eleventy-plugin-bundle': 3.0.7(posthtml@0.16.7) '@11ty/eleventy-utils': 2.0.7 '@11ty/lodash-custom': 4.17.21 - '@11ty/posthtml-urls': 1.0.1 - '@11ty/recursive-copy': 4.0.2 + '@11ty/posthtml-urls': 1.0.3 + '@11ty/recursive-copy': 4.0.4 '@sindresorhus/slugify': 2.2.1 bcp-47-normalize: 2.3.0 chokidar: 3.6.0 @@ -1649,7 +1629,7 @@ snapshots: iso-639-1: 3.1.5 js-yaml: 4.1.1 kleur: 4.1.5 - liquidjs: 10.24.0 + liquidjs: 10.25.7 luxon: 3.7.2 markdown-it: 14.1.1 minimist: 1.2.8 @@ -1661,7 +1641,7 @@ snapshots: posthtml: 0.16.7 posthtml-match-helper: 2.0.3(posthtml@0.16.7) semver: 7.7.4 - slugify: 1.6.6 + slugify: 1.6.9 tinyglobby: 0.2.15 transitivePeerDependencies: - bufferutil @@ -1670,18 +1650,18 @@ snapshots: '@11ty/lodash-custom@4.17.21': {} - '@11ty/posthtml-urls@1.0.1': + '@11ty/posthtml-urls@1.0.3': dependencies: evaluate-value: 2.0.0 http-equiv-refresh: 2.0.1 list-to-array: 1.1.0 parse-srcset: 1.0.2 - '@11ty/recursive-copy@4.0.2': + '@11ty/recursive-copy@4.0.4': dependencies: errno: 1.0.0 junk: 3.1.0 - maximatch: 0.1.0 + minimatch: 3.1.5 slash: 3.0.0 '@cspell/cspell-bundled-dicts@9.8.0': @@ -2087,18 +2067,8 @@ snapshots: argparse@2.0.1: {} - array-differ@1.0.0: {} - array-timsort@1.0.3: {} - array-union@1.0.2: - dependencies: - array-uniq: 1.0.3 - - array-uniq@1.0.3: {} - - arrify@1.0.1: {} - asap@2.0.6: {} balanced-match@1.0.2: {} @@ -2614,7 +2584,7 @@ snapshots: dependencies: uc.micro: 2.1.0 - liquidjs@10.24.0: + liquidjs@10.25.7: dependencies: commander: 10.0.1 @@ -2675,13 +2645,6 @@ snapshots: transitivePeerDependencies: - supports-color - maximatch@0.1.0: - dependencies: - array-differ: 1.0.0 - array-union: 1.0.2 - arrify: 1.0.1 - minimatch: 3.1.2 - mdn-data@2.0.28: {} mdurl@2.0.0: {} @@ -2873,7 +2836,7 @@ snapshots: mime@3.0.0: {} - minimatch@3.1.2: + minimatch@3.1.5: dependencies: brace-expansion: 1.1.12 @@ -3099,7 +3062,7 @@ snapshots: slash@5.1.0: {} - slugify@1.6.6: {} + slugify@1.6.9: {} smol-toml@1.6.1: {}