Compare commits

...

16 Commits

Author SHA1 Message Date
Mark Dumay
f2509b07af Merge pull request #199 from gethinode/develop
Navigation
2023-04-06 09:49:34 +02:00
mark
4b606deafd Clean up style 2023-04-06 09:40:11 +02:00
mark
d9f805d4a4 Bump release version 2023-04-06 09:33:10 +02:00
mark
a62bea018b Refine TOC offset 2023-04-06 09:31:09 +02:00
mark
2596f2d7ee Refine heading offset 2023-04-06 09:31:02 +02:00
mark
2bcd955402 Fix #154 2023-04-06 09:09:17 +02:00
Mark Dumay
511ad2cb4c Merge pull request #198 from gethinode/develop
Navbar
2023-04-06 06:21:07 +02:00
mark
b87a91f6df Fix #128 2023-04-06 06:17:30 +02:00
mark
11b8bb4c69 Bump release version 2023-04-06 06:05:00 +02:00
mark
84fab6b8a8 Improve alignment of navbar elements 2023-04-06 06:04:29 +02:00
Mark Dumay
656770352a Merge pull request #197 from gethinode/develop
Configurable sidebar version
2023-04-05 13:17:07 +02:00
mark
1dadce3f92 Bump release version 2023-04-05 13:11:57 +02:00
mark
8d428d3b51 Make sidebar version configurable 2023-04-05 13:11:28 +02:00
Mark Dumay
8de8204f0e Merge pull request #196 from gethinode/develop
Clean up
2023-04-05 09:20:30 +02:00
mark
e5d2ece0b7 Bump release version 2023-04-05 09:16:00 +02:00
mark
01159ceea2 Remove debug statement 2023-04-05 09:10:07 +02:00
11 changed files with 63 additions and 34 deletions

View File

@@ -18,3 +18,14 @@ a:active {
.tickmark li::marker { .tickmark li::marker {
content: ""; content: "";
} }
.anchor
{
color: transparent;
}
.heading:hover .anchor
{
transition: 0.25s ease-in-out;
color: $primary;
}

View File

@@ -24,6 +24,10 @@
border: 0 if($enable-important-utilities, !important, null); border: 0 if($enable-important-utilities, !important, null);
} }
.fw-30 {
width: 30px !important;
}
/* Lines of the Toggler */ /* Lines of the Toggler */
.toggler-icon { .toggler-icon {
width: 30px; width: 30px;

View File

@@ -6,9 +6,9 @@
grid-area: toc; grid-area: toc;
right: 0; right: 0;
z-index: 2; z-index: 2;
height: calc(100vh - 7rem); height: calc(100vh - 5rem);
overflow-y: auto; overflow-y: auto;
top: $navbar-offset; top: 5rem;
} }
// scss-docs-end toc // scss-docs-end toc

View File

@@ -21,10 +21,11 @@
# toml-docs-start navigation # toml-docs-start navigation
[navigation] [navigation]
anchor = true
logo = "/img/logo_icon.svg" logo = "/img/logo_icon.svg"
color = "body" color = "body"
fixed = true fixed = true
offset = "5em" offset = "3.8em"
search = true search = true
breadcrumb = false breadcrumb = false
toc = true toc = true

View File

@@ -0,0 +1,5 @@
{{ if site.Params.navigation.anchor }}
<h{{ .Level }} id="{{ .Anchor | safeURL }}" class="heading">{{ .Text | safeHTML }} <a href="#{{ .Anchor | safeURL }}"><i class="fa-solid fa-link anchor"></i></a></h{{ .Level }}>
{{ else }}
<h{{ .Level }} id="{{ .Anchor | safeURL }}">{{ .Text | safeHTML }}</h{{ .Level }}>
{{ end }}

View File

@@ -1,4 +1,6 @@
{{- $section := .Section }}
{{- with partial "utilities/GetMenu" . }}{{ $.Scratch.Set "sidebar" . }}{{ end -}} {{- with partial "utilities/GetMenu" . }}{{ $.Scratch.Set "sidebar" . }}{{ end -}}
{{ $.Scratch.Set "version" (site.Param (printf "%s.version" .Section)) }}
<!doctype html> <!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="no-js" data-bs-theme="dark"> <html lang="{{ .Site.Language.Lang }}" class="no-js" data-bs-theme="dark">

View File

@@ -69,6 +69,7 @@
{{ define "main" -}} {{ define "main" -}}
{{- $menu := .Scratch.Get "sidebar" -}} {{- $menu := .Scratch.Get "sidebar" -}}
{{- $version := .Scratch.Get "version" -}}
{{- $sidebar := .Site.Params.navigation.sidebar | default true -}} {{- $sidebar := .Site.Params.navigation.sidebar | default true -}}
{{ if and $menu $sidebar -}} {{ if and $menu $sidebar -}}
<div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvass-sidebar" aria-labelledby="offcanvas-label"> <div class="offcanvas offcanvas-start" tabindex="-1" id="offcanvass-sidebar" aria-labelledby="offcanvas-label">
@@ -77,14 +78,14 @@
<button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button> <button type="button" class="btn-close" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div> </div>
<div class="offcanvas-body"> <div class="offcanvas-body">
{{ partial "assets/sidebar" (dict "page" . "menu" $menu) }} {{ partial "assets/sidebar" (dict "page" . "menu" $menu "version" $version) }}
</div> </div>
</div> </div>
<div class="container-fluid"> <div class="container-fluid">
<div class="row row-cols-md-2 row-cols-lg-3"> <div class="row row-cols-md-2 row-cols-lg-3">
<div class="col col-md-3 col-lg-2 d-none pt-5 d-md-block sidebar-overflow sticky-top"> <div class="col col-md-3 col-lg-2 d-none pt-5 d-md-block sidebar-overflow sticky-top">
{{ partial "assets/sidebar" (dict "page" . "menu" $menu) }} {{ partial "assets/sidebar" (dict "page" . "menu" $menu "version" $version) }}
</div> </div>
<div class="col col-md-9 col-lg-8 mb-5 p-4"> <div class="col col-md-9 col-lg-8 mb-5 p-4">
{{ partial "partials/header.html" . }} {{ partial "partials/header.html" . }}

View File

@@ -79,19 +79,21 @@
{{- $pre := .Pre -}} {{- $pre := .Pre -}}
{{- $post := .Post -}} {{- $post := .Post -}}
<nav class="navbar navbar-expand-{{ $size }} {{ with $color }}bg-{{ . }}{{ end }} {{ if $fixed }}fixed-top{{ end }} p-3"> <nav class="navbar navbar-expand-{{ $size }} {{ with $color }}bg-{{ . }}{{ end }} {{ if $fixed }}fixed-top{{ end }} p-4">
<div class="container-fluid"> <div class="container-fluid p-0">
<!-- Insert sidebar toggler when applicable --> <!-- Insert sidebar toggler when applicable -->
{{- if $page.Scratch.Get "sidebar" -}} <div class="d-flex">
<button class="navbar-toggler collapsed ms-n3" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvass-sidebar" aria-controls="offcanvass-sidebar" aria-label="{{ T "toggleSidebar" }}"> {{- if $page.Scratch.Get "sidebar" -}}
{{- partial "assets/icon.html" (dict "icon" "fas ellipsis") -}} <button class="navbar-toggler fw-30 collapsed p-0 mx-auto" type="button" data-bs-toggle="offcanvas" data-bs-target="#offcanvass-sidebar" aria-controls="offcanvass-sidebar" aria-label="{{ T "toggleSidebar" }}">
</button> {{- partial "assets/icon.html" (dict "icon" "fas ellipsis") -}}
{{- else -}} </button>
<!-- Insert invisible sidebar toggler to center logo correctly on smaller screens --> {{- else -}}
<button class="navbar-toggler collapsed ms-n3 invisible" type="button"> <!-- Insert invisible sidebar toggler to center logo correctly on smaller screens -->
{{- partial "assets/icon.html" (dict "icon" "fas ellipsis") -}} <button class="navbar-toggler fw-30 collapsed p-0 mx-auto invisible" type="button">
</button> {{- partial "assets/icon.html" (dict "icon" "fas ellipsis") -}}
{{- end -}} </button>
{{- end -}}
</div>
<!-- Insert the brand logo or name --> <!-- Insert the brand logo or name -->
<a class="navbar-brand mx-auto" href="{{ site.Home.RelPermalink }}"> <a class="navbar-brand mx-auto" href="{{ site.Home.RelPermalink }}">
@@ -103,12 +105,14 @@
</a> </a>
<!-- Insert main navigation toggler --> <!-- Insert main navigation toggler -->
<button id="main-nav-toggler" class="navbar-toggler collapsed me-n3" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent-{{ $id }}" <div class="d-flex fw-30">
aria-controls="navbarSupportedContent-{{ $id }}" aria-expanded="false" aria-label="{{ T "toggleMainNav" }}"> <button id="main-nav-toggler" class="navbar-toggler collapsed p-0" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent-{{ $id }}"
<span class="toggler-icon top-bar emphasis"></span> aria-controls="navbarSupportedContent-{{ $id }}" aria-expanded="false" aria-label="{{ T "toggleMainNav" }}">
<span class="toggler-icon middle-bar emphasis"></span> <span class="toggler-icon top-bar emphasis"></span>
<span class="toggler-icon bottom-bar emphasis"></span> <span class="toggler-icon middle-bar emphasis"></span>
</button> <span class="toggler-icon bottom-bar emphasis"></span>
</button>
</div>
<div class="navbar-collapse collapse" id="navbarSupportedContent-{{ $id }}"> <div class="navbar-collapse collapse" id="navbarSupportedContent-{{ $id }}">
<!-- Insert search input --> <!-- Insert search input -->
@@ -120,17 +124,18 @@
{{- $menu_item_url := $menu.URL | relLangURL -}} {{- $menu_item_url := $menu.URL | relLangURL -}}
{{- $page_url:= $page.RelPermalink | relLangURL -}} {{- $page_url:= $page.RelPermalink | relLangURL -}}
{{- $active := hasPrefix $page_url $menu_item_url -}} {{- $active := hasPrefix $page_url $menu_item_url -}}
{{- $url := urls.Parse .URL -}} {{- $url := urls.Parse .URL -}}
{{- $baseurl := urls.Parse $.Site.Params.Baseurl -}} {{- $baseurl := urls.Parse $.Site.Params.Baseurl -}}
{{- if .HasChildren -}} {{- if .HasChildren -}}
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<a class="nav-link {{ if $active }}active{{ end }} dropdown-toggle" href="{{ .URL }}" role="button" data-bs-toggle="dropdown" aria-expanded="false"> <a class="nav-link {{ if $active }}active{{ end }} dropdown-toggle" href="{{ .URL }}" role="button" data-bs-toggle="dropdown" aria-expanded="false">
{{ if $active }}<span class="active">{{ .Name }}</span>{{ else }}{{ .Name }}{{ end }} {{ if $active }}<span class="active">{{ .Name }}</span>{{ else }}{{ .Name }}{{ end }}
</a> </a>
<ul class="dropdown-menu dropdown-menu-end"> <ul class="dropdown-menu dropdown-menu-end">
{{- range .Children -}} {{- range .Children -}}
<li><a class="dropdown-item" href="{{ .URL }}">{{ .Name }}</a></li> {{- $child_active := eq $page_url .URL -}}
<li><a class="dropdown-item {{ if $child_active }}active{{ end }}" href="{{ .URL }}">{{ .Name }}</a></li>
{{- end -}} {{- end -}}
</ul> </ul>
</li> </li>

View File

@@ -1,6 +1,7 @@
{{- $page := .page }} {{- $page := .page }}
{{- $section := $page.Section }} {{- $section := $page.Section }}
{{- $data := .menu -}} {{- $data := .menu -}}
{{- $version := .version -}}
{{- define "partials/sidebar/group.html" -}} {{- define "partials/sidebar/group.html" -}}
{{- $page := .page -}} {{- $page := .page -}}
@@ -11,8 +12,7 @@
{{- $doc_slug := $group.title | urlize -}} {{- $doc_slug := $group.title | urlize -}}
{{- $href := printf "%s/" (relLangURL (path.Join $baseURL $doc_slug)) -}} {{- $href := printf "%s/" (relLangURL (path.Join $baseURL $doc_slug)) -}}
{{ $collapsed := strings.HasPrefix $page.RelPermalink $href }} {{- $collapsed := strings.HasPrefix $page.RelPermalink $href -}}
{{ warnf "Page: %s" $href }}
<li class="mb-1"> <li class="mb-1">
<button class="btn btn-toggle d-inline-flex align-items-center rounded border-0 collapsed" data-bs-toggle="collapse" data-bs-target="#sidebar-collapse-{{ $index }}-{{ $level }}" aria-expanded="{{ if $collapsed }}true{{ else }}false{{ end }}"> <button class="btn btn-toggle d-inline-flex align-items-center rounded border-0 collapsed" data-bs-toggle="collapse" data-bs-target="#sidebar-collapse-{{ $index }}-{{ $level }}" aria-expanded="{{ if $collapsed }}true{{ else }}false{{ end }}">
@@ -80,9 +80,9 @@
{{ if $data }} {{ if $data }}
<nav class="sidebar flex-shrink-0 ps-1 pt-3" aria-label="{{ (strings.FirstUpper $section) }} navigation"> <nav class="sidebar flex-shrink-0 ps-1 pt-3" aria-label="{{ (strings.FirstUpper $section) }} navigation">
{{- $sectionBreak := false }} {{- $sectionBreak := false -}}
{{ $level := 0}} {{- $level := 0 -}}
{{ $baseURL := relLangURL (path.Join $section site.Params.docs.version) }} {{- $baseURL := relLangURL (path.Join $section $version) }}
<ul class="list-unstyled ps-0"> <ul class="list-unstyled ps-0">
{{- range $index, $item := $data -}} {{- range $index, $item := $data -}}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.11.0", "version": "0.11.4",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.11.0", "version": "0.11.4",
"license": "MIT", "license": "MIT",
"devDependencies": { "devDependencies": {
"@fortawesome/fontawesome-free": "^6.4.0", "@fortawesome/fontawesome-free": "^6.4.0",

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.11.0", "version": "0.11.4",
"description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator", "description": "Hinode is a clean documentation and blog theme for Hugo, an open-source static site generator",
"keywords": [ "keywords": [
"hugo", "hugo",