Add support for single page menu

This commit is contained in:
Dmitry Kolosov 2020-06-24 22:21:59 +03:00
parent 6e0b0b6fc7
commit 193fbeca7c
4 changed files with 91 additions and 12 deletions

View File

@ -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.

View File

@ -1,10 +1,27 @@
+++
title = "About"
description = "Hugo, the worlds fastest framework for building websites"
date = "2019-02-28"
aliases = ["about-us","about-hugo","contact"]
author = "Hugo Authors"
+++
---
title: "About"
description: "Hugo, the worlds 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.

View File

@ -1,4 +1,11 @@
{{ define "main" }}
{{ if .Menus }}
<nav class="post-navigation">
{{ range .Menus }}
<a href="{{ .URL | absLangURL }}" title="{{ .Title }}">{{ .Name }}</a>
{{ end }}
</nav>
{{ end }}
<article class="post">
<header>
@ -10,7 +17,7 @@
{{ partial "postInfo.html" . }}
</article>
{{ if .Site.Params.paginationSinglePost}}
{{ if and (.Site.Params.paginationSinglePost) (ne .Type "page") }}
{{ partial "paginationPost.html" . }}
{{ end }}

View File

@ -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;
}