Skip to content

Commit

Permalink
Project docs left sidebar (#264)
Browse files Browse the repository at this point in the history
* 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 <patrick@iotaschool.com>

* Added menu items for other projects

Resolves #250

Signed-off-by: Patrick Smyth <patrick@iotaschool.com>

* Add logic to make external docs open in new tab

Signed-off-by: Patrick Smyth <patrick@iotaschool.com>

---------

Signed-off-by: Patrick Smyth <patrick@iotaschool.com>
  • Loading branch information
smythp authored Nov 7, 2023
1 parent fb21144 commit d433051
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 39 deletions.
52 changes: 16 additions & 36 deletions config/_default/menus/menus.en.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
19 changes: 16 additions & 3 deletions layouts/partials/sidebar/auto-collapsible-menu.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,22 @@
<ul class="list-unstyled collapsible-sidebar">
{{ $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 }}


<!-- This changed from Doks default to reflect no "docs" section folder -->
{{ range site.Sections }}
{{ range $Sections }}
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ md5 .Title }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}">
Expand Down Expand Up @@ -46,8 +60,7 @@
</li>
{{ else }}
{{ $active := in $currentPage.RelPermalink .RelPermalink }}
<li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .Permalink }}">

<li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .Permalink }}" {{ if isset . "TargetBlank" }}target="_blank"{{ end }}>
{{ partial "partials/sidebar/menu-item.html" . }}

</a></li>
Expand Down

0 comments on commit d433051

Please sign in to comment.