From d4330512f9be57aee1821b137907b3547f03c17e Mon Sep 17 00:00:00 2001 From: Patrick Smyth Date: Tue, 7 Nov 2023 11:59:16 -0500 Subject: [PATCH] Project docs left sidebar (#264) * Created logic for external sites on sidebar Update template to refer to a menu defined in menus configuration named "external." Entries in the external menu will appear under a header called "project documentation." Created logic to add the new section heading Created logic to simulate page data structure for rendering in doks template logic that expects pages, not menu items Create logic to add simulated pages to the correct section Updated menus configuration to remove vestigial menu data and create a test item (cosign external docs) Signed-off-by: Patrick Smyth * Added menu items for other projects Resolves #250 Signed-off-by: Patrick Smyth * Add logic to make external docs open in new tab Signed-off-by: Patrick Smyth --------- Signed-off-by: Patrick Smyth --- config/_default/menus/menus.en.toml | 52 ++++++------------- .../sidebar/auto-collapsible-menu.html | 19 +++++-- 2 files changed, 32 insertions(+), 39 deletions(-) diff --git a/config/_default/menus/menus.en.toml b/config/_default/menus/menus.en.toml index b1a9df67..abac4c3a 100644 --- a/config/_default/menus/menus.en.toml +++ b/config/_default/menus/menus.en.toml @@ -1,46 +1,26 @@ -[[docs]] +[[external]] name = "Cosign" - weight = 20 - identifier = "cosign" - url = "/docs/cosign/" - -[[docs]] - name = "About" weight = 10 - identifier = "about" - url = "/docs/about/" + identifier = "cosign" + url = "https://github.com/sigstore/cosign/tree/main/doc" -[[docs]] - name = "Policy Controller" - weight = 30 - identifier = "policy-controller" - url = "/docs/policy-controller/" +[[external]] + name = "Fulcio" + weight = 20 + identifier = "fulcio" + url = "https://github.com/sigstore/fulcio/tree/main/docs" -[[docs]] +[[external]] name = "Gitsign" - weight = 40 + weight = 30 identifier = "gitsign" - url = "/docs/gitsign/" - -[[docs]] - name = "Rekor" - weight = 50 - identifier = "rekor" - url = "/docs/rekor/" - -[[docs]] - name = "Get Involved" - weight = 60 - identifier = "get_involved" - url = "/docs/get_involved/" - -[[docs]] - name = "Help" - weight = 70 - identifier = "help" - url = "/docs/help/" - + url = "https://github.com/sigstore/gitsign/tree/main/docs" +[[external]] + name = "Policy Controller" + weight = 40 + identifier = "policy-controller" + url = "https://github.com/sigstore/policy-controller/blob/main/docs/api-types/index.md" # [[main]] # name = "Docs" diff --git a/layouts/partials/sidebar/auto-collapsible-menu.html b/layouts/partials/sidebar/auto-collapsible-menu.html index 3b90f76c..65b6670c 100644 --- a/layouts/partials/sidebar/auto-collapsible-menu.html +++ b/layouts/partials/sidebar/auto-collapsible-menu.html @@ -2,8 +2,22 @@
    {{ $currentPage := . -}} + {{ $ExternalDocsPages := slice }} + + {{- range site.Menus.external }} + + {{ $NewPage := dict "TargetBlank" true "Title" .Name "Permalink" .ConfiguredURL }} + {{ $ExternalDocsPages = $ExternalDocsPages | append $NewPage }} + +{{ end }} + + {{ $ExternalSiteSection := dict "Title" "Project Documentation" "Pages" $ExternalDocsPages }} + + {{ $Sections := site.Sections | append $ExternalSiteSection }} + + - {{ range site.Sections }} + {{ range $Sections }} {{ $active := in $currentPage.RelPermalink .RelPermalink }}
  • {{ else }} {{ $active := in $currentPage.RelPermalink .RelPermalink }} -
  • - +
  • {{ partial "partials/sidebar/menu-item.html" . }}