feat: add page parameter geekdocAlign to control a pages text alignment (#130)

uci-hugo-doc
Robert Kaussow 2021-05-19 00:00:57 +02:00 committed by GitHub
parent cd0cfe37ae
commit e629d15607
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 48 additions and 3 deletions

View File

@ -1,7 +1,8 @@
---
title: Documentation
title: Welcome to the documentation
description: Geekdoc is a simple Hugo theme for documentations. It is intentionally designed as a fast and lean theme and may not fit the requirements of complex projects. If a more feature-complete theme is required there are a lot of got alternatives out there.
geekdocNav: false
geekdocAlign: center
---
<!-- markdownlint-capture -->

View File

@ -248,6 +248,9 @@ geekdocAnchor = true
# page from search data, feeds, etc.
# WARNING: Consider hosting a standalone, fully auth-protected static page for secret information instead!
geekdocProtected = false
# Set 'left' (default), 'center' or 'right' to configure the text align of a page.
geekdocAlign = "left"
```
{{< /tab >}}
@ -305,6 +308,9 @@ geekdocAnchor: true
# page from search data, feeds, etc.
# WARNING: Consider hosting a standalone, fully auth-protected static page for secret information instead!
geekdocProtected: false
# Set 'left' (default), 'center' or 'right' to configure the text align of a page.
geekdocAlign: "left"
```
{{< /tab >}}

View File

@ -1,6 +1,6 @@
{{ define "main" }}
{{ partial "page-header" . }}
<article class="gdoc-markdown">
<article class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.GeekdocAlign | lower) }}">
<h1>{{ partial "title" . }}</h1>
{{ partial "content" . }}
</article>

View File

@ -1,7 +1,7 @@
{{ define "main" }}
{{ partial "page-header" . }}
<article class="gdoc-markdown">
<article class="gdoc-markdown gdoc-markdown__align--{{ default "left" (.Page.Params.GeekdocAlign | lower) }}">
<h1>{{ partial "title" . }}</h1>
{{ partial "content" . }}
</article>

View File

@ -178,4 +178,42 @@
overflow: auto;
max-height: var(--code-max-height);
}
&__align {
&--left {
h1,
h2,
h3,
h4,
h5,
h6 {
justify-content: flex-start;
}
text-align: left;
}
&--center {
h1,
h2,
h3,
h4,
h5,
h6 {
justify-content: center;
}
text-align: center;
}
&--right {
h1,
h2,
h3,
h4,
h5,
h6 {
justify-content: flex-end;
}
text-align: right;
}
}
}