Skip to content

Commit

Permalink
Rework left-hand nav order
Browse files Browse the repository at this point in the history
- Refactor config file for legibiltiy
- Write new menu logic to pick manual menu from config file
- Replace spaces with dashes in folder names
  • Loading branch information
geriom authored and tekton-robot committed Feb 8, 2023
1 parent a474765 commit dbe0a93
Show file tree
Hide file tree
Showing 15 changed files with 209 additions and 125 deletions.
121 changes: 0 additions & 121 deletions config.toml

This file was deleted.

107 changes: 107 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
baseURL: /
title: Tekton
enableRobotsTXT: true
theme:
- github.com/google/docsy
- github.com/google/docsy/dependencies
enableGitInfo: true
contentDir: content/en
defaultContentLanguage: en
defaultContentLanguageInSubdir: false
enableMissingTranslationPlaceholders: true
disableKinds:
- taxonomy
- taxonomyTerm
pygmentsCodeFences: true
pygmentsUseClasses: false
pygmentsUseClassic: false
pygmentsStyle: manni
enableEmoji: true
ignoreFiles:
- vendor/.*
rss_sections:
- blog
permalinks:
blog: /:section/:year/:month/:day/:slug/
markup:
defaultMarkdownHandler: goldmark
goldmark:
renderer:
unsafe: true
imaging:
resampleFilter: CatmullRom
quality: 75
anchor: smart
services:
googleAnalytics:
id: UA-154682132-1
languages:
en:
title: Tekton
description: Cloud Native CI/CD
languageName: English
weight: 1
params:
version_menu: Releases
github_repo: https://github.com/tektoncd/website
gcs_engine_id: 013756393218025596041:6eajntqsa6c
ui:
sidebar_menu_compact: false
sidebar_menu_foldable: true
breadcrumb_disable: false
sidebar_search_disable: false
navbar_logo: true
footer_about_disable: false
feedback:
enable: true
yes:
Thanks! <a href="https://github.com/tektoncd/website/issues/new">Tell us
how we can further improve</a>.
no: Sorry about that. <a
href="https://github.com/tektoncd/website/issues/new">Tell us how we can
further improve</a>.
links:
developer:
- name: GitHub
url: https://github.com/tektoncd
icon: fab fa-github
desc: GitHub organization for the Tekton project
sectionPagesMenu: "docs"
menu:
docs:
- name: "Getting Started"
url: "/docs/getting-started/"
weight: 1
- name: "Installation"
url: "/docs/installation/"
weight: 2
- name: "Concepts"
url: "/docs/concepts/"
weight: 3
- name: "How-to Guides"
url: "/docs/how-to-guides/"
weight: 4
- name: "Tasks and Pipelines"
url: "/docs/pipelines/"
weight: 5
- name: "Triggers and EventListeners"
url: "/docs/triggers/"
weight: 6
- name: "Command-Line Interface"
url: "/docs/cli/"
weight: 7
- name: "Supply Chain Security"
url: "/docs/chains/"
weight: 8
- name: "Operator"
url: "/docs/operator/"
weight: 9
- name: "Dashboard"
url: "/docs/dashboard/"
weight: 10
- name: "Results"
url: "/docs/results/"
weight: 11
- name: "Contribute"
url: "/docs/contribute/"
weight: 100
2 changes: 2 additions & 0 deletions content/en/docs/Concepts/_index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<!--
---
title: "Concepts"
linkTitle: "Concepts"
weight: 3
description: >
Conceptual and technical information about Tekton
---
-->

This section presents an overview of what the Tekton project is and how some of
its building blocks work.
Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/Contribute/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
---
title: "Contribute to Documentation"
linkTitle: "Contribute to Documentation"
weight: 11
weight: 0
description: >
Contribution guidelines
---
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions content/en/docs/Installation/_index.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<!--
---
title: "Installation"
linkTitle: "Installation"
weight: 2
description: >
Installation instructions for Tekton components
---
-->

This section contains guides to install the latest version of the Tekton
components. For other versions, select the component and version from the
Expand Down
5 changes: 2 additions & 3 deletions content/en/docs/_index.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

---
title: "Welcome to Tekton"
linkTitle: "Documentation"
weight: 20
weight: 1
menu:
main:
weight: 20
weight: 1
---

Tekton is a cloud-native solution for building CI/CD systems. It consists of
Expand Down
67 changes: 67 additions & 0 deletions layouts/partials/sidebar-tree-docs.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{{/* Render documentation nav from definition in config file */}}

<div id="td-sidebar-menu" class="td-sidebar__inner">
{{ if not .Site.Params.ui.sidebar_search_disable -}}
<form class="td-sidebar__search d-flex align-items-center">
{{ partial "search-input.html" . }}
<button class="btn btn-link td-sidebar__toggle d-md-none p-0 ml-3 fas fa-bars" type="button" data-toggle="collapse" data-target="#td-section-nav" aria-controls="td-section-nav" aria-expanded="false" aria-label="Toggle section navigation">
</button>
</form>
{{ else -}}
<div id="content-mobile">
<form class="td-sidebar__search d-flex align-items-center">
{{ partial "search-input.html" . }}
<button class="btn btn-link td-sidebar__toggle d-md-none p-0 ml-3 fas fa-bars" type="button" data-toggle="collapse" data-target="#td-section-nav" aria-controls="td-section-nav" aria-expanded="false" aria-label="Toggle section navigation">
</button>
</form>
</div>
<div id="content-desktop"></div>
{{ end -}}

<nav class="collapse td-sidebar-nav foldable-nav" id="td-section-nav" >
{{ $navRoot := cond (and (ne .Params.toc_root true) (eq .Site.Home.Type "docs")) .Site.Home .FirstSection -}}
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) -}}
{{ $activePath := true }}
<ul class="td-sidebar-nav__section pr-md-3 ul-0">
<li class="td-sidebar-nav__section-title td-sidebar-nav__section with-child active-path" id="{{ $mid }}-li">
<a href="/docs/" class="align-left tree-root pl-0 active td-sidebar-link tid-sidebar-link__section" id=" {{ $mid }}"><span class="td-sidebar-nav-active-item">Documentation</span></a>
<ul class="ul-1">
{{- $active := false -}}
{{ $currentPage := . -}}
{{- range .Site.Menus.docs -}}
{{- $mid = printf "m-%s" (.URL | anchorize) -}}
{{- $activePath = false -}}
{{- $docMenu := . -}}
{{- $inMain := false -}}
{{- range $navRoot.Site.Menus.main -}}
{{if eq .Name $docMenu.Name }}
{{ $inMain = true }}
{{ end }}
{{- end -}}

{{- if not $inMain }}
{{ $active = eq $currentPage.RelPermalink .URL }}
{{ $activePath = (strings.Contains $currentPage.RelPermalink .URL) }}
<li class="td-sidebar-nav__section-title td-sidebar-nav__section with-child{{ if $activePath }} active-path{{ end }}" id="{{ $mid }}-li">
<input type="checkbox" id="{{ $mid }}-check"{{ if $activePath}} checked{{ end }}/>
<label for="{{ $mid }}-check"><a href="{{ .URL }}" class="align-left pl-0{{ if $active }} active{{ end }} td-sidebar-link td-sidebar-link__section" id="{{ $mid }}" title="{{ .Title }}"><span class="{{ if $active }}td-sidebar-nav-active-item{{ end }}"> {{ .Name }}</span></a></label>

{{ $p := $navRoot.Site.GetPage .URL }}
<ul class="ul-2 foldable">
{{ range $p.Pages -}}
{{- $mid = printf "m-%s" (.RelPermalink | anchorize) -}}
{{- $active = eq $currentPage.RelPermalink .RelPermalink -}}
<li class="td-sidebar-nav__section-title td-sidebar-nav__section without-child{{ if $active }} active-path{{ end }}" id="{{ $mid }}-li">
<input type="checkbox" id="{{ $mid }}-check"{{ if $active}} checked{{ end }}/>
<label for="{{ $mid }}-check"><a class="align-left pl-0 {{ if $active}} active{{ end }} td-sidebar-link td-sidebar-link__page" id="{{ $mid }}" href="{{ .RelPermalink }}"><span class="{{ if $active }}td-sidebar-nav-active-item{{ end }}"> {{ .LinkTitle }}</span></a></label>
</li>
</li>
{{- end -}}
</ul>
{{ end -}}
{{ end -}}
</ul>
</li>
</ul>
</nav>
</div>
28 changes: 28 additions & 0 deletions layouts/partials/sidebar.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{/* The "active" toggle here may delay rendering, so we only cache this side bar menu for bigger sites.
*/}}{{ $sidebarCacheLimit := cond (isset .Site.Params.ui "sidebar_cache_limit") .Site.Params.ui.sidebar_cache_limit 2000 -}}
{{ $shouldCache := ge (len .Site.Pages) $sidebarCacheLimit -}}
{{ $sidebarCacheTypeRoot := cond (isset .Site.Params.ui "sidebar_cache_type_root") .Site.Params.ui.sidebar_cache_type_root false -}}
{{ $isDocs := (strings.Contains .RelPermalink "docs/") }}
{{ if $shouldCache -}}
{{ $mid := printf "m-%s" (.RelPermalink | anchorize) }}
<script>
$(function() {
$("#td-section-nav a").removeClass("active");
$("#td-section-nav #{{ $mid }}").addClass("active");
$("#td-section-nav #{{ $mid }}-li span").addClass("td-sidebar-nav-active-item");
$("#td-section-nav #{{ $mid }}").parents("li").addClass("active-path");
$("#td-section-nav li.active-path").addClass("show");
$("#td-section-nav li.active-path").children("input").prop('checked', true);
$("#td-section-nav #{{ $mid }}-li").siblings("li").addClass("show");
$("#td-section-nav #{{ $mid }}-li").children("ul").children("li").addClass("show");
$("#td-sidebar-menu").toggleClass("d-none");
});
</script>
{{ partialCached "sidebar-tree.html" . .FirstSection.RelPermalink }}
{{ else -}}
{{ if $isDocs -}}
{{ partial "sidebar-tree-docs.html" . }}
{{- else -}}
{{ partial "sidebar-tree.html" . }}
{{- end }}
{{- end }}

0 comments on commit dbe0a93

Please sign in to comment.