re-add guides top-level menu

This commit is contained in:
Danny Salman 2022-11-16 18:09:52 -05:00
parent 82ae31aa92
commit 39ee6479ae
9 changed files with 165 additions and 42 deletions

View File

@ -4,48 +4,57 @@
weight = 10
[[main]]
name = "Reference"
name = "Guides"
url = "/guides/"
weight = 20
identifier = "reference"
[[reference]]
name = "Specifications"
weight = 10
identifier = "specifications"
url = "https://github.com/libp2p/specs/"
[[reference]]
name = "Connectivity"
weight = 20
identifier = "connectivity"
url = "https://connectivity.libp2p.io/"
[[reference]]
name = "Implementations"
weight = 30
identifier = "implementations"
url = "https://libp2p.io/implementations/"
[[main]]
name = "Community"
url = "/community/"
weight = 40
identifier = "community"
[[community]]
name = "Get Involved"
url = "https://libp2p.io/#community"
weight = 10
[[community]]
name = "Forum"
url = "https://discuss.libp2p.io/"
weight = 10
[[main]]
name = "Blog"
url = "/blog/"
weight = 30
[[main]]
name = "Reference"
weight = 40
identifier = "reference"
[[main]]
name = "Specifications"
weight = 10
identifier = "specifications"
url = "https://github.com/libp2p/specs/"
parent = "reference"
[[main]]
name = "Connectivity"
weight = 20
identifier = "connectivity"
url = "https://connectivity.libp2p.io/"
parent = "reference"
[[main]]
name = "Implementations"
weight = 30
identifier = "implementations"
url = "https://libp2p.io/implementations/"
parent = "reference"
[[main]]
name = "Community"
weight = 50
identifier = "community"
[[main]]
name = "Get Involved"
url = "https://libp2p.io/#community"
weight = 10
parent = "community"
[[main]]
name = "Forum"
url = "https://discuss.libp2p.io/"
weight = 20
parent = "community"
[[social]]
name = "GitHub"

View File

@ -1,6 +0,0 @@
---
title : "Run a Node"
description: "The getting started tutorial covers setting up a development environment, getting familiar
with libp2p basics, and implementing a simple node that can send and receive ping messages."
weight: 10
---

View File

@ -0,0 +1,6 @@
---
title: "Guides"
description: "How-to guides, tutorials, and examples related to libp2p"
draft: false
images: []
---

22
layouts/guides/list.html Normal file
View File

@ -0,0 +1,22 @@
{{ define "main" }}
<div class="row justify-content-center">
<div class="col-md-12 col-lg-10 col-xl-8">
<article>
<h1 class="text-center">{{ if eq .CurrentSection .FirstSection }}{{ .Section | humanize }}{{ else }}{{ .Title }}{{ end }}</h1>
<div class="text-center">{{ .Content }}</div>
<div class="card-list">
{{ $currentSection := .CurrentSection }}
{{ range where .Site.RegularPages.ByTitle "Section" .Section }}
{{ if in (.RelPermalink | string) $currentSection.RelPermalink }}
<div class="card my-3">
<div class="card-body">
<a class="stretched-link" href="{{ .RelPermalink }}">{{ .Params.title | title }} &rarr;</a>
</div>
</div>
{{ end }}
{{ end }}
</div>
</article>
</div>
</div>
{{ end }}

View File

@ -0,0 +1,53 @@
{{ define "main" }}
<div class="row flex-xl-nowrap">
<div class="col-lg-5 col-xl-4 docs-sidebar{{ if ne .Site.Params.options.navbarSticky true }} docs-sidebar-top{{ end }} d-none d-lg-block">
<nav {{ if eq .Site.Params.menu.section.collapsibleSidebar false }}id="sidebar-default" {{ end }}class="docs-links" aria-label="Main navigation">
{{ partial "sidebar/docs-menu.html" . }}
</nav>
</div>
{{ if ne .Params.toc false -}}
<nav class="docs-toc{{ if ne .Site.Params.options.navbarSticky true }} docs-toc-top{{ end }} d-none d-xl-block col-xl-3" aria-label="Secondary navigation">
{{ partial "sidebar/docs-toc.html" . }}
</nav>
{{ end -}}
{{ if .Params.toc -}}
<main class="docs-content col-lg-11 col-xl{{ if eq .Site.Params.options.fullWidth false }}-9{{ end }}">
{{ else -}}
<main class="docs-content col-lg-11 col-xl-9 mx-xl-auto">
{{ end -}}
{{ if .Site.Params.options.breadCrumb -}}
<!-- https://discourse.gohugo.io/t/breadcrumb-navigation-for-highly-nested-content/27359/6 -->
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
{{ partial "main/breadcrumb" . -}}
<li class="breadcrumb-item active" aria-current="page">{{ .Title }}</li>
</ol>
</nav>
{{ end }}
<h1>{{ .Title }}</h1>
<p class="lead">{{ .Params.lead | safeHTML }}</p>
{{ if ne .Params.toc false -}}
<nav class="d-xl-none" aria-label="Quaternary navigation">
{{ partial "sidebar/docs-toc.html" . }}
</nav>
{{ end -}}
{{ .Content }}
<div class="page-footer-meta d-flex flex-column flex-md-row justify-content-between">
{{ if .Site.Params.lastMod -}}
{{ partial "main/last-modified.html" . }}
{{ end -}}
{{ if .Site.Params.editPage -}}
{{ partial "main/edit-page.html" . }}
{{ end -}}
</div>
{{ partial "main/docs-navigation.html" . }}
<!--
{{ if not .Site.Params.options.collapsibleSidebar -}}
{{ partial "main/docs-navigation.html" . }}
{{ else -}}
<div class="my-n3"></div>
{{ end -}}
-->
</main>
</div>
{{ end }}

View File

@ -0,0 +1,39 @@
{{ if .Site.Params.options.collapsibleSidebar -}}
<ul class="list-unstyled collapsible-sidebar">
{{ $currentPage := . -}}
{{ range $index, $element := .Site.Menus.guides -}}
{{- $active := or ($currentPage.IsMenuCurrent "guides" .) ($currentPage.HasMenuCurrent "guides" .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li class="mb-1">
<button class="btn btn-toggle align-items-center rounded collapsed" data-bs-toggle="collapse" data-bs-target="#section-{{ .Identifier }}" aria-expanded="{{ if $active }}true{{ else }}false{{ end }}">
{{ .Name }}
</button>
{{ if .HasChildren -}}
<div class="collapse{{ if $active }} show{{ end }}" id="section-{{ .Identifier }}">
<ul class="btn-toggle-nav list-unstyled fw-normal pb-1 small">
{{ range .Children -}}
{{- $active := or ($currentPage.IsMenuCurrent "guides" .) ($currentPage.HasMenuCurrent "guides" .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link rounded{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}}
</ul>
</div>
{{ end -}}
</li>
{{ end -}}
</ul>
{{ else -}}
{{ $currentPage := . -}}
{{ range .Site.Menus.guides -}}
<h3 class="h6 text-uppercase">{{ .Name }}</h3>
{{ if .HasChildren -}}
<ul class="list-unstyled">
{{ range .Children -}}
{{- $active := or ($currentPage.IsMenuCurrent "guides" .) ($currentPage.HasMenuCurrent "guides" .) -}}
{{- $active = or $active (eq $currentPage.Section .Identifier) -}}
<li><a class="docs-link{{ if $active }} active{{ end }}" href="{{ .URL | relURL }}">{{ .Name }}</a></li>
{{ end -}}
</ul>
{{ end -}}
{{ end -}}
{{ end -}}