From 193fbeca7c029c9715844f5c80b0d9f378224179 Mon Sep 17 00:00:00 2001 From: Dmitry Kolosov Date: Wed, 24 Jun 2020 22:21:59 +0300 Subject: [PATCH] Add support for single page menu --- exampleSite/content/about-subpage.md | 23 +++++++++++++++++ exampleSite/content/about.md | 31 ++++++++++++++++++----- layouts/_default/single.html | 11 ++++++-- static/css/style.css | 38 +++++++++++++++++++++++++--- 4 files changed, 91 insertions(+), 12 deletions(-) create mode 100644 exampleSite/content/about-subpage.md diff --git a/exampleSite/content/about-subpage.md b/exampleSite/content/about-subpage.md new file mode 100644 index 0000000..1d1dc16 --- /dev/null +++ b/exampleSite/content/about-subpage.md @@ -0,0 +1,23 @@ +--- +title: "Subpage" +description: "Just a subpage of about" +date: "2019-02-28" +author: "Hugo Authors" +slug: /about/subpage +menu: + about: + identifier: about + name: About + title: About + url: /about + weight: 1 + subpage: + identifier: subpage + parent: about + name: Subpage + title: Subpage + url: /about/subpage/ + weight: 10 +--- + +Just a subpage of About. diff --git a/exampleSite/content/about.md b/exampleSite/content/about.md index a412806..59b428d 100644 --- a/exampleSite/content/about.md +++ b/exampleSite/content/about.md @@ -1,10 +1,27 @@ -+++ -title = "About" -description = "Hugo, the world’s fastest framework for building websites" -date = "2019-02-28" -aliases = ["about-us","about-hugo","contact"] -author = "Hugo Authors" -+++ +--- +title: "About" +description: "Hugo, the world’s fastest framework for building websites" +date: "2019-02-28" +aliases: + - "about-us" + - "about-hugo" + - "contact" +author: "Hugo Authors" +menu: + about: + identifier: about + name: About + title: About + url: /about + weight: 1 + subpage: + identifier: subpage + parent: about + name: Subpage + title: Subpage + url: /about/subpage + weight: 10 +--- Written in Go, Hugo is an open source static site generator available under the [Apache Licence 2.0.](https://github.com/gohugoio/hugo/blob/master/LICENSE) Hugo supports TOML, YAML and JSON data file types, Markdown and HTML content files and uses shortcodes to add rich content. Other notable features are taxonomies, multilingual mode, image processing, custom output formats, HTML/CSS/JS minification and support for Sass SCSS workflows. diff --git a/layouts/_default/single.html b/layouts/_default/single.html index b90866c..6f61195 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -1,5 +1,12 @@ {{ define "main" }} - + {{ if .Menus }} + + {{ end }} +

{{ trim .Title " " }}

@@ -10,7 +17,7 @@ {{ partial "postInfo.html" . }}
- {{ if .Site.Params.paginationSinglePost}} + {{ if and (.Site.Params.paginationSinglePost) (ne .Type "page") }} {{ partial "paginationPost.html" . }} {{ end }} diff --git a/static/css/style.css b/static/css/style.css index 80fd701..c8e38b9 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -69,15 +69,14 @@ a:hover { } a:hover, -a:focus { +a:focus, +a:active { color: #a31d1d; border-bottom: 1px solid rgba(163, 29, 29, .5); } a:active { - color: #a31d1d; opacity: 0.9; - border-bottom: 1px solid rgba(163, 29, 29, .5); } a.skip-main { @@ -215,6 +214,29 @@ main h1 { /* Articles */ +.post-navigation { + text-align: center; + margin-top: 1em; + max-width: 100%; + background: #fafafa; + padding: 0.5em 0; +} + +.post-navigation a:first-of-type { + margin-left: 0; +} + +.post-navigation a { + color: #696969; + margin-left: 2em; +} + +.post-navigation a:hover, +.post-navigation a:focus, +.post-navigation a:active { + color: #a31d1d; +} + .post-title.favorite::after { content: "★"; display: inline-block; @@ -444,6 +466,16 @@ ul.language-select > li { margin-left: 5%; } + .post-navigation { + text-align: center; + background: #fafafa; + padding: 0.5em 0; + } + + .post-navigation a { + margin-left: 0.5em; + } + .post-pagination .pagination-item { max-width: 10em; }