Compare commits

...

28 Commits

Author SHA1 Message Date
Mark Dumay
becba931bc Merge pull request #364 from gethinode/develop
Fix sharing links
2023-07-26 17:49:23 +02:00
Mark Dumay
03e3c5b3ee Merge branch 'main' into develop 2023-07-26 17:41:40 +02:00
mark
311aa3b957 Bump package release 2023-07-26 17:40:56 +02:00
mark
62db3eb9db Fix sharing links 2023-07-26 17:40:24 +02:00
Mark Dumay
56ea9eec47 Merge pull request #363 from gethinode/develop
Add canonifyAssetsURLs option
2023-07-26 17:31:55 +02:00
mark
b845e210b7 Add canonifyAssetsURLs option 2023-07-26 17:13:53 +02:00
Mark Dumay
e8bba05213 Merge pull request #362 from gethinode/main
Sync with main
2023-07-26 15:19:14 +02:00
Mark Dumay
74d0d625c6 Merge pull request #361 from gethinode/permalink
Use relative permalinks by default
2023-07-26 15:04:36 +02:00
mark
9d98a3568c Bump package release 2023-07-26 14:58:01 +02:00
Mark Dumay
dc55571f7a Merge pull request #360 from gethinode/main
Sync with main
2023-07-26 14:55:57 +02:00
Mark Dumay
b7ab9d5690 Merge pull request #359 from gethinode/develop
Refinement
2023-07-26 14:49:44 +02:00
mark
5d20be19a8 Update path for color script 2023-07-26 14:43:15 +02:00
mark
ecae077e2d Use relative permalinks by default 2023-07-26 14:41:55 +02:00
Mark Dumay
132c316ff0 Merge branch 'main' into develop 2023-07-26 14:38:08 +02:00
mark
a3b9081b4d Bump package version 2023-07-26 14:03:25 +02:00
mark
8a689a95de Bump dependencies 2023-07-26 14:02:44 +02:00
mark
9bd04a5b2a Fix complement error for undefined core modules 2023-07-26 09:19:30 +02:00
mark
8dc884f846 Add npm install command 2023-07-26 09:02:31 +02:00
Mark Dumay
4cb558440b Merge pull request #357 from gethinode/hugo-mod-dependencies
Update Hugo module dependencies
2023-07-24 20:01:52 +02:00
mark
0d78918aa4 Set dark mode to disabled by default 2023-07-24 17:18:23 +02:00
mark
ba7ab907ef Fix behavior of critical scripts 2023-07-24 17:18:06 +02:00
markdumay
af557ac054 fix: update Hugo module dependencies 2023-07-23 03:15:51 +00:00
Mark Dumay
9ada0eee80 Merge pull request #355 from gethinode/develop
Fix behavior in default state
2023-07-22 14:57:41 +02:00
Mark Dumay
ae3e20b596 Merge branch 'main' into develop 2023-07-22 14:46:19 +02:00
mark
c49e6f14c1 Bump package version 2023-07-22 14:45:17 +02:00
mark
b4f6b1aa3d Move bootstrap mod check to base template 2023-07-22 14:44:46 +02:00
mark
962549f2ae Allow undefined main menu 2023-07-22 13:13:40 +02:00
Mark Dumay
28601323c4 Update README.md 2023-07-22 07:52:46 +02:00
21 changed files with 75 additions and 46 deletions

View File

@@ -1,5 +1,5 @@
assets/js/critical/color.js
assets/js/analytics.js assets/js/analytics.js
assets/js/color.js
assets/js/flexsearch.js assets/js/flexsearch.js
assets/js/vendor assets/js/vendor
node_modules node_modules

View File

@@ -56,10 +56,11 @@
- [PageSpeed Insights][pagespeed] - [PageSpeed Insights][pagespeed]
- [Mozilla Observatory][observatory] - [Mozilla Observatory][observatory]
Hinode is a clean documentation and blog theme for [Hugo][hugo], an open-source static site generator. Based on the [Bootstrap 5][bootstrap] framework, the rendered site is fast, secure, and responsive. Hinode uses [FlexSearch][flexsearch] to enable full text search across your site. Finally, the theme uses [Node Package Manager][npm] to automate the build process and to keep track of dependencies. Hinode is a clean documentation and blog theme for [Hugo][hugo], an open-source static site generator. Based on the [Bootstrap 5][bootstrap] framework, the rendered site is fast, secure, and responsive. Hinode uses [FlexSearch][flexsearch] to enable full text search across your site. Finally, the theme supports [Node Package Manager][npm] to automate the build process and to keep track of dependencies.
Additional features include: Additional features include:
- Flexible configuration of Hugo modules
- Switching between light mode and dark mode - Switching between light mode and dark mode
- Support for multiple languages - Support for multiple languages
- Reusable Bootstrap components through configurable shortcodes and partials - Reusable Bootstrap components through configurable shortcodes and partials

View File

@@ -1,3 +1,5 @@
{{- if site.Params.main.enableDarkMode -}}
/*! /*!
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/) * Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors * Copyright 2011-2022 The Bootstrap Authors
@@ -68,3 +70,5 @@
}) })
}) })
})() })()
{{- end -}}

View File

@@ -5,10 +5,6 @@
@import "common/variables.scss"; @import "common/variables.scss";
@import "common/icons.scss"; @import "common/icons.scss";
{{ if not (in site.Params.modules.core "bootstrap") }}
{{ errorf "Bootstrap is a required module, please add it to 'modules.core' in your site parameters" }}
{{ end }}
// Import Bootstrap configuration (mounted by core Bootstrap module) // Import Bootstrap configuration (mounted by core Bootstrap module)
@import "bootstrap.scss"; @import "bootstrap.scss";

View File

@@ -4,6 +4,7 @@
description = "Hinode is a clean documentation and blog theme for your Hugo site based on Bootstrap 5." description = "Hinode is a clean documentation and blog theme for your Hugo site based on Bootstrap 5."
enableDarkMode = true enableDarkMode = true
modes = ["light", "dark"] modes = ["light", "dark"]
canonifyAssetsURLs = false
# toml-docs-end main # toml-docs-end main
# toml-docs-start modules # toml-docs-start modules

2
go.mod
View File

@@ -4,7 +4,7 @@ go 1.19
require ( require (
github.com/gethinode/mod-bootstrap v1.1.0 // indirect github.com/gethinode/mod-bootstrap v1.1.0 // indirect
github.com/gethinode/mod-flexsearch v1.1.2 // indirect github.com/gethinode/mod-flexsearch v1.1.4 // indirect
github.com/gethinode/mod-fontawesome v1.2.1 // indirect github.com/gethinode/mod-fontawesome v1.2.1 // indirect
github.com/gethinode/mod-katex v1.0.2 // indirect github.com/gethinode/mod-katex v1.0.2 // indirect
github.com/gethinode/mod-leaflet v0.3.3 // indirect github.com/gethinode/mod-leaflet v0.3.3 // indirect

4
go.sum
View File

@@ -10,6 +10,10 @@ github.com/gethinode/mod-flexsearch v1.1.1 h1:zHypfKR/rWPAwqNXvo09Pp3vGqU4w3r7d2
github.com/gethinode/mod-flexsearch v1.1.1/go.mod h1:TXbGbWsvmhBdsTzRt887mcpFfr4ORpzG3+h/l4W3YM4= github.com/gethinode/mod-flexsearch v1.1.1/go.mod h1:TXbGbWsvmhBdsTzRt887mcpFfr4ORpzG3+h/l4W3YM4=
github.com/gethinode/mod-flexsearch v1.1.2 h1:vA/jHxLq9xxkYGS9cmAoLNIkEBW+iLVCcQ8qKyEa+R4= github.com/gethinode/mod-flexsearch v1.1.2 h1:vA/jHxLq9xxkYGS9cmAoLNIkEBW+iLVCcQ8qKyEa+R4=
github.com/gethinode/mod-flexsearch v1.1.2/go.mod h1:TXbGbWsvmhBdsTzRt887mcpFfr4ORpzG3+h/l4W3YM4= github.com/gethinode/mod-flexsearch v1.1.2/go.mod h1:TXbGbWsvmhBdsTzRt887mcpFfr4ORpzG3+h/l4W3YM4=
github.com/gethinode/mod-flexsearch v1.1.3 h1:lzmSvnJL6ABjp03avYzSvJJ7hw01CpHap1JGUbDIELg=
github.com/gethinode/mod-flexsearch v1.1.3/go.mod h1:TXbGbWsvmhBdsTzRt887mcpFfr4ORpzG3+h/l4W3YM4=
github.com/gethinode/mod-flexsearch v1.1.4 h1:dJvwBxYlLe/VGlctLn8k89STJ5toATIjNnXIlNeanOY=
github.com/gethinode/mod-flexsearch v1.1.4/go.mod h1:TXbGbWsvmhBdsTzRt887mcpFfr4ORpzG3+h/l4W3YM4=
github.com/gethinode/mod-fontawesome v1.0.2 h1:ZSK6D20/w4y5GnfYfTBB58uHD0ChIfkpKfRGwioS9rg= github.com/gethinode/mod-fontawesome v1.0.2 h1:ZSK6D20/w4y5GnfYfTBB58uHD0ChIfkpKfRGwioS9rg=
github.com/gethinode/mod-fontawesome v1.0.2/go.mod h1:Ki1qkWEOiF0hQpCgWeZRw+HkpL6nd1DxKFptU0O2feI= github.com/gethinode/mod-fontawesome v1.0.2/go.mod h1:Ki1qkWEOiF0hQpCgWeZRw+HkpL6nd1DxKFptU0O2feI=
github.com/gethinode/mod-fontawesome v1.1.0 h1:rsDzUI+3ZlS/do2ff3ne8/z3KwHeysmuA+WsXlumXXk= github.com/gethinode/mod-fontawesome v1.1.0 h1:rsDzUI+3ZlS/do2ff3ne8/z3KwHeysmuA+WsXlumXXk=

View File

@@ -12,6 +12,10 @@
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- if and .IsPage (not (in .Site.Params.modules.core "bootstrap")) -}}
{{- errorf "Bootstrap is a required module, please add it to 'modules.core' in your site parameters" -}}
{{- end -}}
<!doctype html> <!doctype html>
<html lang="{{ .Site.Language.Lang }}" class="no-js"> <html lang="{{ .Site.Language.Lang }}" class="no-js">
<head> <head>
@@ -19,9 +23,7 @@
</head> </head>
<body> <body>
{{- if site.Params.main.enableDarkMode -}} {{- partial "footer/scripts.html" (dict "filename" "js/critical.bundle.js" "match" "js/critical/**.js" "header" true "page" .) -}}
{{- partial "footer/scripts.html" (dict "filename" "js/critical.bundle.js" "match" "js/critical/**.js" "header" true "page" .) -}}
{{- end -}}
<div class="d-flex flex-column min-vh-100{{ if and .IsHome .Site.Params.home.style }} {{ .Site.Params.home.style }}{{ end }}"> <div class="d-flex flex-column min-vh-100{{ if and .IsHome .Site.Params.home.style }} {{ .Site.Params.home.style }}{{ end }}">
<div class="{{ if .Site.Params.navigation.fixed }}mb-4{{ end }}"> <div class="{{ if .Site.Params.navigation.fixed }}mb-4{{ end }}">
{{- partial "assets/navbar.html" (dict {{- partial "assets/navbar.html" (dict

View File

@@ -67,7 +67,7 @@
{{ with .NextInSection -}} {{ with .NextInSection -}}
{{ $next := . -}} {{ $next := . -}}
{{ with .OutputFormats.Get "html" -}} {{ with .OutputFormats.Get "html" -}}
<a class="next" href="{{ $next.Permalink }}"><i class="fas fa-arrow-left"></i> {{ $next.Title }}</a> <a class="next" href="{{ $next.RelPermalink }}"><i class="fas fa-arrow-left"></i> {{ $next.Title }}</a>
{{- end -}} {{- end -}}
{{ end -}} {{ end -}}
</div> </div>
@@ -75,7 +75,7 @@
{{ with .PrevInSection -}} {{ with .PrevInSection -}}
{{ $prev := . -}} {{ $prev := . -}}
{{ with .OutputFormats.Get "html" -}} {{ with .OutputFormats.Get "html" -}}
<a class="previous" href="{{ $prev.Permalink }}">{{ $prev.Title }} <i class="fas fa-arrow-right"></i></a> <a class="previous" href="{{ $prev.RelPermalink }}">{{ $prev.Title }} <i class="fas fa-arrow-right"></i></a>
{{- end -}} {{- end -}}
{{ end -}} {{ end -}}
</div> </div>

View File

@@ -7,10 +7,10 @@
{{ $square150 := .Resize "150x150 CatmullRom" }} {{ $square150 := .Resize "150x150 CatmullRom" }}
{{ $wide310 := .Fill "310x150 CatmullRom" }} {{ $wide310 := .Fill "310x150 CatmullRom" }}
{{ $square310 := .Resize "310x310 CatmullRom" }} {{ $square310 := .Resize "310x310 CatmullRom" }}
<square70x70logo src="{{ $square70.Permalink }}" /> <square70x70logo src="{{ $square70.RelPermalink }}" />
<square150x150logo src="{{ $square150.Permalink }}" /> <square150x150logo src="{{ $square150.RelPermalink }}" />
<wide310x150logo src="{{ $wide310.Permalink }}" /> <wide310x150logo src="{{ $wide310.RelPermalink }}" />
<square310x310logo src="{{ $square310.Permalink }}" /> <square310x310logo src="{{ $square310.RelPermalink }}" />
{{ end }} {{ end }}
<TileColor>#000000</TileColor> <TileColor>#000000</TileColor>
</tile> </tile>

View File

@@ -3,7 +3,7 @@
{{- range $index, $item := .Page.Ancestors.Reverse -}} {{- range $index, $item := .Page.Ancestors.Reverse -}}
{{- $title := .Title -}} {{- $title := .Title -}}
{{- if .IsHome }}{{ $title = T "home" }}{{ end -}} {{- if .IsHome }}{{ $title = T "home" }}{{ end -}}
{{- $address := or .Permalink (.Params.Redirect | absLangURL) -}} {{- $address := or .RelPermalink (.Params.Redirect | relLangURL) -}}
{{ if $address }} {{ if $address }}
<li class="breadcrumb-item"><a href="{{ $address }}">{{ $title }}</a></li> <li class="breadcrumb-item"><a href="{{ $address }}">{{ $title }}</a></li>
{{ else }} {{ else }}

View File

@@ -107,12 +107,12 @@
"orientation" $orientation "orientation" $orientation
) -}} ) -}}
{{- if $element.Permalink -}} {{- if $element.RelPermalink -}}
{{- $params = merge $params (dict "path" $element.File.Path) -}} {{- $params = merge $params (dict "path" $element.File.Path) -}}
{{- else -}} {{- else -}}
{{- $params = merge $params (dict {{- $params = merge $params (dict
"title" $element.Title "title" $element.Title
"href" $element.Permalink "href" $element.RelPermalink
"description" (or $element.Description $element.Content) "description" (or $element.Description $element.Content)
"thumbnail" $element.Params.thumbnail "thumbnail" $element.Params.thumbnail
"icon" $element.Params.icon "icon" $element.Params.icon

View File

@@ -111,7 +111,7 @@
{{- with $page -}} {{- with $page -}}
{{- if not $title }}{{ $title = .Title }}{{ end -}} {{- if not $title }}{{ $title = .Title }}{{ end -}}
{{- if not $href }}{{ $href = .Permalink }}{{ end -}} {{- if not $href }}{{ $href = .RelPermalink }}{{ end -}}
{{- if not $description }}{{ $description = .Description }}{{ end -}} {{- if not $description }}{{ $description = .Description }}{{ end -}}
{{- if not $thumbnail }}{{ $thumbnail = .Params.thumbnail }}{{ end -}} {{- if not $thumbnail }}{{ $thumbnail = .Params.thumbnail }}{{ end -}}
{{- if not $icon }}{{ $icon = .Params.icon }}{{ end -}} {{- if not $icon }}{{ $icon = .Params.icon }}{{ end -}}

View File

@@ -15,6 +15,7 @@
--> -->
{{- $validRatios := slice "1x1" "4x3" "16x9" "21x9" -}} {{- $validRatios := slice "1x1" "4x3" "16x9" "21x9" -}}
{{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}}
{{- $ratio := .ratio -}} {{- $ratio := .ratio -}}
{{- $url := .url -}} {{- $url := .url -}}
{{- $mode := false -}} {{- $mode := false -}}
@@ -68,6 +69,7 @@
<!-- Generate a image set of type webp --> <!-- Generate a image set of type webp -->
{{- define "partials/image-scaled.html " -}} {{- define "partials/image-scaled.html " -}}
{{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}}
{{- $img := .img -}} {{- $img := .img -}}
{{- $ratio := .ratio -}} {{- $ratio := .ratio -}}
{{- $imgset := "" -}} {{- $imgset := "" -}}
@@ -98,7 +100,11 @@
{{- $scaled = $img.Fit (printf "%s webp" $dim) -}} {{- $scaled = $img.Fit (printf "%s webp" $dim) -}}
{{- end -}} {{- end -}}
{{- $scaled = $scaled | resources.Copy (replace $img.RelPermalink $clean (printf "-%s.webp" $dim)) -}} {{- $scaled = $scaled | resources.Copy (replace $img.RelPermalink $clean (printf "-%s.webp" $dim)) -}}
{{- $imgset = printf "%s, %s %sw" $imgset $scaled.Permalink (index $widths $index) -}} {{- if $absoluteURL -}}
{{- $imgset = printf "%s, %s %sw" $imgset $scaled.Permalink (index $widths $index) -}}
{{- else -}}
{{- $imgset = printf "%s, %s %sw" $imgset $scaled.RelPermalink (index $widths $index) -}}
{{- end -}}
{{- end -}} {{- end -}}
{{- $imgset = strings.TrimPrefix ", " $imgset -}} {{- $imgset = strings.TrimPrefix ", " $imgset -}}
{{- end -}} {{- end -}}
@@ -108,6 +114,7 @@
<!-- Define the img with optional caption --> <!-- Define the img with optional caption -->
{{- define "partials/image-definition.html" -}} {{- define "partials/image-definition.html" -}}
{{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}}
{{- $ratio := .ratio -}} {{- $ratio := .ratio -}}
{{- $url := .url -}} {{- $url := .url -}}
{{- $outerClass := .outerClass -}} {{- $outerClass := .outerClass -}}
@@ -125,7 +132,11 @@
{{- $img := partial "utilities/GetImage.html" (dict "url" $url) -}} {{- $img := partial "utilities/GetImage.html" (dict "url" $url) -}}
{{- if $img -}} {{- if $img -}}
{{- $fallback := partial "partials/image-default.html" (dict "img" $img "ratio" $ratio) -}} {{- $fallback := partial "partials/image-default.html" (dict "img" $img "ratio" $ratio) -}}
{{- $fallbackURL = $fallback.RelPermalink -}} {{- if $absoluteURL -}}
{{- $fallbackURL = $fallback.Permalink -}}
{{- else -}}
{{- $fallbackURL = $fallback.RelPermalink -}}
{{- end -}}
{{- $imgset = partial "partials/image-scaled.html " (dict "img" $img "ratio" $ratio) -}} {{- $imgset = partial "partials/image-scaled.html " (dict "img" $img "ratio" $ratio) -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@@ -145,7 +156,7 @@
srcset="{{ . }}" srcset="{{ . }}"
sizes="100vw" sizes="100vw"
{{- end }} {{- end }}
src="{{ absURL $fallbackURL }}" src="{{ $fallbackURL }}"
alt="{{ $title }}"> alt="{{ $title }}">
</div> </div>
{{- if $caption -}} {{- if $caption -}}

View File

@@ -93,6 +93,7 @@
</li> </li>
{{- end -}} {{- end -}}
{{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}}
{{- $supportedFlags := slice "true" "false" -}} {{- $supportedFlags := slice "true" "false" -}}
{{- $id := printf "navbar-collapse-%d" 0 -}} {{- $id := printf "navbar-collapse-%d" 0 -}}
@@ -105,11 +106,14 @@
{{- errorf "partial [assets/navbar.html] - Missing value for param 'page'" -}} {{- errorf "partial [assets/navbar.html] - Missing value for param 'page'" -}}
{{- end -}} {{- end -}}
{{- $menuName := "main" }} {{- $defaultMenu := "main" }}
{{- with .menus }}{{ $menuName = .}}{{ end -}} {{- $menuName := $defaultMenu }}
{{- with .menus }}{{ $menuName = . }}{{ end -}}
{{- $menus := index site.Menus $menuName -}} {{- $menus := index site.Menus $menuName -}}
{{- if or (ne (printf "%T" $menus) "navigation.Menu") (ne (index $menus 0).Menu $menuName) -}} {{- if or (ne (printf "%T" $menus) "navigation.Menu") (ne (index $menus 0).Menu $menuName) -}}
{{- errorf "partial [assets/navbar.html] - Invalid value for param 'menus': %s" $menuName -}} {{- if ne $menuName $defaultMenu }}
{{- errorf "partial [assets/navbar.html] - Invalid value for param 'menus': %s" $menuName -}}
{{- end -}}
{{- end -}} {{- end -}}
{{- $size := "md" -}} {{- $size := "md" -}}
@@ -147,7 +151,7 @@
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- $enableDarkMode := default true site.Params.main.enableDarkMode -}} {{- $enableDarkMode := default false site.Params.main.enableDarkMode -}}
{{- with .mode -}} {{- with .mode -}}
{{- $darkModeParam := . -}} {{- $darkModeParam := . -}}
{{- if in $supportedFlags $darkModeParam -}} {{- if in $supportedFlags $darkModeParam -}}
@@ -202,7 +206,7 @@
<!-- 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 }}">
{{- if $logo -}} {{- if $logo -}}
<img src="{{ $logo }}" alt="{{ $title }} logo" height="30"> <img src="{{if $absoluteURL }}{{ absURL $logo }}{{ else }}{{ $logo }}{{ end }}" alt="{{ $title }} logo" height="30">
{{- else -}} {{- else -}}
<span class="fw-bold">{{ $title }}</span> <span class="fw-bold">{{ $title }}</span>
{{- end -}} {{- end -}}
@@ -238,7 +242,7 @@
{{- end -}} {{- end -}}
<!-- Insert divider if applicable --> <!-- Insert divider if applicable -->
{{- if or $enableLanguage $enableVersions -}} {{- if and $menus (or $enableLanguage $enableVersions) -}}
<li class="nav-item py-2 py-md-1 col-12 col-md-auto d-none d-{{ $size }}-block"> <li class="nav-item py-2 py-md-1 col-12 col-md-auto d-none d-{{ $size }}-block">
<div class="vr d-none d-md-flex h-100 mx-md-2"></div> <div class="vr d-none d-md-flex h-100 mx-md-2"></div>
</li> </li>
@@ -258,7 +262,7 @@
<ul class="dropdown-menu dropdown-menu-end "> <ul class="dropdown-menu dropdown-menu-end ">
{{- if $page.IsTranslated -}} {{- if $page.IsTranslated -}}
{{- range $page.AllTranslations -}} {{- range $page.AllTranslations -}}
<li><a class="dropdown-item {{ if eq .Language.Lang $currentLang }}active{{ end }}" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li> <li><a class="dropdown-item {{ if eq .Language.Lang $currentLang }}active{{ end }}" href="{{ .RelPermalink }}">{{ .Language.LanguageName }}</a></li>
{{- end -}} {{- end -}}
{{- else -}} {{- else -}}
{{- range site.Languages -}} {{- range site.Languages -}}

View File

@@ -49,7 +49,7 @@
{{- with $page -}} {{- with $page -}}
{{- if not $title }}{{ $title = .Title }}{{ end -}} {{- if not $title }}{{ $title = .Title }}{{ end -}}
{{- if not $href }}{{ $href = .Permalink }}{{ end -}} {{- if not $href }}{{ $href = .RelPermalink }}{{ end -}}
{{- if not $content }}{{ $content = .Content }}{{ end -}} {{- if not $content }}{{ $content = .Content }}{{ end -}}
{{- if not $thumbnail }}{{ $thumbnail = .Params.thumbnail }}{{ end -}} {{- if not $thumbnail }}{{ $thumbnail = .Params.thumbnail }}{{ end -}}
{{- end -}} {{- end -}}

View File

@@ -1,3 +1,4 @@
{{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}}
{{- $filename := .filename | default "js/main.bundle.js" -}} {{- $filename := .filename | default "js/main.bundle.js" -}}
{{- $match := .match | default "{js/*.js,js/vendor/**.js}" -}} {{- $match := .match | default "{js/*.js,js/vendor/**.js}" -}}
{{- $page := .page -}} {{- $page := .page -}}
@@ -23,9 +24,11 @@
{{- end }} {{- end }}
{{- end -}} {{- end -}}
{{- if not hugo.IsProduction -}} {{- if gt (len $js.Content) 0 -}}
<script src="{{ $js.Permalink }}"></script> {{- if not hugo.IsProduction -}}
{{ else -}} <script src="{{ if $absoluteURL }}{{ $js.Permalink }}{{ else }}{{ $js.RelPermalink }}{{ end }}"></script>
{{ $js = $js | minify | fingerprint -}} {{ else -}}
<script src="{{ $js.Permalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous"></script> {{ $js = $js | minify | fingerprint -}}
<script src="{{ if $absoluteURL }}{{ $js.Permalink }}{{ else }}{{ $js.RelPermalink }}{{ end }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous"></script>
{{ end -}}
{{ end -}} {{ end -}}

View File

@@ -1,10 +1,11 @@
<!-- Source: https://davelage.com/posts/hugo-favicons/ --> <!-- Source: https://davelage.com/posts/hugo-favicons/ -->
{{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}}
{{ if .Site.Params.favicon.logo -}} {{ if .Site.Params.favicon.logo -}}
{{ $favicon := resources.Get .Site.Params.favicon.logo -}} {{ $favicon := resources.Get .Site.Params.favicon.logo -}}
{{ range $i := .Site.Params.favicon.sizes -}} {{ range $i := .Site.Params.favicon.sizes -}}
{{ $image := $favicon.Resize (printf "%dx%d CatmullRom" $i $i) -}} {{ $image := $favicon.Resize (printf "%dx%d CatmullRom" $i $i) -}}
<link rel="icon" type="image/png" sizes="{{$i}}x{{$i}}" href="{{ $image.Permalink }}"> <link rel="icon" type="image/png" sizes="{{$i}}x{{$i}}" href="{{ if $absoluteURL }}{{ $image.Permalink }}{{ else }}{{ $image.RelPermalink }}{{ end }}">
{{ end -}} {{ end -}}
{{ $image := $favicon.Resize "180x CatmullRom" -}} {{ $image := $favicon.Resize "180x CatmullRom" -}}
<link rel="apple-touch-icon" sizes="180x180" href="{{ $image.Permalink }}"> <link rel="apple-touch-icon" sizes="180x180" href="{{ if $absoluteURL }}{{ $image.Permalink }}{{ else }}{{ $image.RelPermalink }}{{ end }}">
{{ end -}} {{ end -}}

View File

@@ -1,3 +1,4 @@
{{- $absoluteURL := site.Params.main.canonifyAssetsURLs | default false -}}
{{- $source := .source | default "scss/app.scss" -}} {{- $source := .source | default "scss/app.scss" -}}
{{- $target := .target | default "css/main.css" -}} {{- $target := .target | default "css/main.css" -}}
{{- $page := .page -}} {{- $page := .page -}}
@@ -6,7 +7,7 @@
{{- $modules := "" -}} {{- $modules := "" -}}
{{ if $core }} {{ if $core }}
{{- if reflect.IsSlice site.Params.modules.excludeSCSS -}} {{- if reflect.IsSlice site.Params.modules.excludeSCSS -}}
{{- $modules = complement site.Params.modules.excludeSCSS site.Params.modules.core -}} {{- $modules = complement site.Params.modules.excludeSCSS (or site.Params.modules.core slice) -}}
{{ else }} {{ else }}
{{- $modules = site.Params.modules.core -}} {{- $modules = site.Params.modules.core -}}
{{ end }} {{ end }}
@@ -43,8 +44,8 @@
{{- end -}} {{- end -}}
{{- if not hugo.IsProduction -}} {{- if not hugo.IsProduction -}}
<link rel="stylesheet" href="{{ $css.Permalink }}"> <link rel="stylesheet" href="{{ if $absoluteURL }}{{ $css.Permalink }}{{ else }}{{ $css.RelPermalink }}{{ end }}">
{{- else -}} {{- else -}}
{{- $css = $css | fingerprint | resources.PostProcess -}} {{- $css = $css | fingerprint | resources.PostProcess -}}
<link rel="stylesheet" href="{{ $css.Permalink }}" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous"> <link rel="stylesheet" href="{{ if $absoluteURL }}{{ $css.Permalink }}{{ else }}{{ $css.RelPermalink }}{{ end }}" integrity="{{ $css.Data.Integrity }}" crossorigin="anonymous">
{{- end -}} {{- end -}}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.16.2", "version": "0.16.6",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@gethinode/hinode", "name": "@gethinode/hinode",
"version": "0.16.2", "version": "0.16.6",
"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.16.2", "version": "0.16.6",
"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",
@@ -20,7 +20,7 @@
"prestart": "npm run clean && npm run mod:vendor", "prestart": "npm run clean && npm run mod:vendor",
"start": "hugo server --bind=0.0.0.0 --disableFastRender", "start": "hugo server --bind=0.0.0.0 --disableFastRender",
"start:prod": "hugo server --bind=0.0.0.0 --disableFastRender --printI18nWarnings -e production", "start:prod": "hugo server --bind=0.0.0.0 --disableFastRender --printI18nWarnings -e production",
"prebuild": "npm run clean", "prebuild": "npm run clean && npm run -s mod:install",
"build": "hugo --gc --minify", "build": "hugo --gc --minify",
"build:debug": "hugo -e debug --debug", "build:debug": "hugo -e debug --debug",
"build:preview": "npm run build -D -F", "build:preview": "npm run build -D -F",
@@ -32,6 +32,7 @@
"lint:markdown": "markdownlint-cli2 \"*.md\" \"content/**/*.md\"", "lint:markdown": "markdownlint-cli2 \"*.md\" \"content/**/*.md\"",
"lint:markdown-fix": "markdownlint-cli2-fix \"*.md\" \"content/**/*.md\"", "lint:markdown-fix": "markdownlint-cli2-fix \"*.md\" \"content/**/*.md\"",
"mod:clean": "hugo mod clean", "mod:clean": "hugo mod clean",
"mod:install": "hugo mod get ./... && npm run -s mod:vendor && npm run -s mod:tidy",
"mod:update": "hugo mod get -u ./... && npm run -s mod:vendor && npm run -s mod:tidy", "mod:update": "hugo mod get -u ./... && npm run -s mod:vendor && npm run -s mod:tidy",
"mod:tidy": "hugo mod tidy", "mod:tidy": "hugo mod tidy",
"mod:vendor": "rimraf _vendor && hugo mod vendor", "mod:vendor": "rimraf _vendor && hugo mod vendor",
@@ -43,7 +44,7 @@
"create:syntax-light": "hugo gen chromastyles --style=github > ./assets/scss/components/_syntax-light.scss", "create:syntax-light": "hugo gen chromastyles --style=github > ./assets/scss/components/_syntax-light.scss",
"create:syntax-dark": "hugo gen chromastyles --style=github-dark > ./assets/scss/components/_syntax-dark.scss", "create:syntax-dark": "hugo gen chromastyles --style=github-dark > ./assets/scss/components/_syntax-dark.scss",
"update:syntax-dark": "replace-in-files --string=\"#ffffcc\" --replacement=\"#b8b800\" ./assets/scss/components/_syntax-dark.scss", "update:syntax-dark": "replace-in-files --string=\"#ffffcc\" --replacement=\"#b8b800\" ./assets/scss/components/_syntax-dark.scss",
"upgrade": "npx npm-check-updates -u" "upgrade": "npx npm-check-updates -u && mod:update"
}, },
"repository": { "repository": {
"type": "git", "type": "git",