diff --git a/assets/sprites/geekblog.svg b/assets/sprites/geekblog.svg deleted file mode 100644 index 0964b0b..0000000 --- a/assets/sprites/geekblog.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index f1e3e51..4255b94 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -84,4 +84,5 @@ params: geekblogPrivacyPolicy: https://thegeeklab.de/legal-notice/#privacy-policy geekblogImageLazyLoading: true + geekblogDarkModeDim: true geekblogTagsToMenu: true diff --git a/exampleSite/content/posts/features/code-blocks.md b/exampleSite/content/posts/features/code-blocks.md new file mode 100644 index 0000000..1212958 --- /dev/null +++ b/exampleSite/content/posts/features/code-blocks.md @@ -0,0 +1,101 @@ +--- +title: Code Blocks +date: 2021-11-21T15:00:00+01:00 +authors: + - john-doe +tags: + - Documentation + - Features +--- + +There are several ways to add code blocks. Most of them work out of the box, only the Hugo short code `` needs to be configured to work properly. The theme also provides some additional features like a copy button and an option to set the maximum length of code blocks. Both of these functions and the dependent formatting rely on the `.highlight` CSS class. You must ensure that you always assign a language to your code blocks if you want to use these functions. If you do not want to apply syntax highlighting, you can also specify `plain` or `text` as the language. + +{{< toc >}} + +## Inline code + +To display an inline shortcode use single quotes: + +```plain +`some code` +``` + +**Example:** `some code` + +## Code blocks + +Code blocks can be uses without language specification: + +````markdown +```Plain +some code +``` +```` + +**Example:** + +```Plain +some code +``` + +... or if you need language specific syntax highlighting: + +````markdown +```Shell +# some code +echo "Hello world" +``` +```` + +**Example:** + +```Shell +# some code +echo "Hello World" +``` + +## Highlight shortcode + +Hugo has a build-in shortcode for syntax highlighting. To work properly with this theme, you have to set following options in your site configuration: + +{{< tabs "uniqueid" >}} +{{< tab "TOML" >}} + +```TOML +pygmentsUseClasses=true +pygmentsCodeFences=true +``` + +{{< /tab >}} +{{< tab "YAML" >}} + +```YAML +pygmentsUseClasses: true +pygmentsCodeFences: true +``` + +{{< /tab >}} +{{< /tabs >}} + +You can use it like every other shortcode: + + +```markdown +{{}} +# some code +echo "Hello World" +{{}} +``` + +**Example:** + + + + +{{< highlight Shell "linenos=table" >}} +# some code +echo "Hello World" +{{< /highlight >}} + + + diff --git a/exampleSite/content/posts/features/dark-mode/images/geekblog-dark.png b/exampleSite/content/posts/features/dark-mode/images/geekblog-dark.png new file mode 100644 index 0000000..aa88b41 Binary files /dev/null and b/exampleSite/content/posts/features/dark-mode/images/geekblog-dark.png differ diff --git a/exampleSite/content/posts/features/dark-mode/index.md b/exampleSite/content/posts/features/dark-mode/index.md new file mode 100644 index 0000000..c713d06 --- /dev/null +++ b/exampleSite/content/posts/features/dark-mode/index.md @@ -0,0 +1,19 @@ +--- +title: Dark Mode +date: 2021-11-21T15:00:00+01:00 +authors: + - john-doe +tags: + - Documentation + - Features +--- + +Say hello to the dark mode of the Geekblog theme! + +[![Geekblog in dark mode](images/geekblog-dark.png)](images/geekblog-dark.png) + +The dark mode can be used in two different ways. If you have JavaScript disabled in your browser, the dark mode automatically detects the preferred system settings via the `prefers-color-scheme` parameter. Depending on the value, the theme will automatically switch between dark and light mode if this feature is supported by your operating system and browser. + +The second mode requires JavaScript and is controlled by a dark mode switch in the upper right corner. You can switch between three modes: Auto, Dark and Light. Auto mode works the same as the first method mentioned above and automatically detects the system setting. Dark and Light modes allow you to force one of them for your Geekblog page only, regardless of the system setting. This works even if your browser or operating system does not support the system setting. The current selection is stored locally via the Web Storage API. + +To avoid very bright spots often caused by images while using the dark mode we have added an optional auto-dim feature that can be enabled with the site parameter `geekblogDarkModeDim` (see [Configuration](/posts/usage/configuration/)). As this may have an impact on the quality of the images it is disabled by default. diff --git a/exampleSite/content/posts/features/theming/images/theme-example.png b/exampleSite/content/posts/features/theming/images/theme-example.png new file mode 100644 index 0000000..c5ce087 Binary files /dev/null and b/exampleSite/content/posts/features/theming/images/theme-example.png differ diff --git a/exampleSite/content/posts/features/theming.md b/exampleSite/content/posts/features/theming/index.md similarity index 67% rename from exampleSite/content/posts/features/theming.md rename to exampleSite/content/posts/features/theming/index.md index edbdc18..3ef0e14 100644 --- a/exampleSite/content/posts/features/theming.md +++ b/exampleSite/content/posts/features/theming/index.md @@ -8,12 +8,24 @@ tags: - Features --- -Personalize the look of your site. - - - {{< toc >}} +## Color Scheme + +If you want to customize the theme's color scheme to give it your individual touch, you are only a few lines of CSS away. Generally, you need to override the default settings. The easiest way to do this is to create a file named `static/custom.css` right at the root of your site. + +All the necessary CSS customization properties are listed below. If you want to customize elements that don't use these properties, you can always look up the class name and override it directly. For inspiration, you can also take a look at [https://www.color-hex.com/color-palettes/](https://www.color-hex.com/). In this simple example, we'll use the [_Beach_](https://www.color-hex.com/color-palette/895) color palette. + +[![Beach Color Palette](images/theme-example.png)](images/theme-example.png) + +**Custom CSS:** + + + +{{< include file="/static/custom.css.example" language="CSS" options="linenos=table" >}} + + + ## Favicons The Theme is shipped with a set of default Favicons in various formats generated by a [Favicon Generator](https://realfavicongenerator.net/). All files can be found in the `static/favicon` folder of the release tarball. To make the replacement of the default Favicons as simple as possible, the theme loads only a very small subset of the Favicon formats. @@ -51,3 +63,5 @@ If you want to add more Favicon formats you have to [overwrite](https://gohugo.i ``` + +Happy customizing! diff --git a/exampleSite/content/posts/post-with-images/index.md b/exampleSite/content/posts/post-with-images/index.md index e082eff..51d080b 100644 --- a/exampleSite/content/posts/post-with-images/index.md +++ b/exampleSite/content/posts/post-with-images/index.md @@ -78,7 +78,7 @@ resources: credits: "[Jay Mantri](https://unsplash.com/@jaymantri) on [Unsplash](https://unsplash.com/s/photos/forest)" --- -{{}} +{{}} ``` diff --git a/exampleSite/content/posts/usage/configuration.md b/exampleSite/content/posts/usage/configuration.md index 35799cd..d4d0ca2 100644 --- a/exampleSite/content/posts/usage/configuration.md +++ b/exampleSite/content/posts/usage/configuration.md @@ -120,6 +120,10 @@ enableRobotsTXT = true # (Optional, default true) Enable or disable adding tags automatically to the main menu. geekblogTagsToMenu = true + # (Optional, default false) Auto-decrease brightness of images and add a slightly grayscale to avoid + # bright spots while using the dark mode. + geekblogDarkModeDim = false + # (Optional, default none) Adds a "Hosted on " line to the footer. # Could be used if you want to give credits to your hosting provider. [params.geekblogHostedOn] @@ -138,9 +142,9 @@ enableRobotsTXT = true ```Yaml --- -# ... - -theme: hugo-geekblog +baseURL: "http://localhost" +title: "Geekblog" +theme: "hugo-geekblog" paginate: 5 pluralizeListTitles: false @@ -245,6 +249,10 @@ params: # (Optional, default true) Enable or disable adding tags automatically to the main menu. geekblogTagsToMenu: true + # (Optional, default false) Auto-decrease brightness of images and add a slightly grayscale to avoid + # bright spots while using the dark mode. + geekblogDarkModeDim: false + # (Optional, default none) Adds a "Hosted on " line to the footer. # Could be used if you want to give credits to your hosting provider. geekblogHostedOn: diff --git a/exampleSite/content/posts/usage/getting-started.md b/exampleSite/content/posts/usage/getting-started.md index 6943fa4..4908e03 100644 --- a/exampleSite/content/posts/usage/getting-started.md +++ b/exampleSite/content/posts/usage/getting-started.md @@ -249,6 +249,7 @@ There are a lot more things to discover. To get the most out of the Theme we hav - [Configuration](/posts/usage/configuration/) - [Menus](/posts/usage/menus/) - **Features** + - [Code Blocks](/posts/features/code-blocks/) - [Icon Sets](/posts/features/icon-sets/) - [Theming](/posts/features/theming/) - [Authors](/posts/features/authors/) diff --git a/exampleSite/static/custom.css b/exampleSite/static/custom.css index 1cf3314..7be1537 100644 --- a/exampleSite/static/custom.css +++ b/exampleSite/static/custom.css @@ -1,3 +1,7 @@ +:root { + --code-max-height: 60rem; +} + .icon-grid { width: 8rem; height: 8rem; diff --git a/exampleSite/static/custom.css.example b/exampleSite/static/custom.css.example new file mode 100644 index 0000000..b9ae4f9 --- /dev/null +++ b/exampleSite/static/custom.css.example @@ -0,0 +1,150 @@ +/* Global customization */ + +:root { + --code-max-height: 60rem; +} + +/* Light mode theming */ +:root, +:root[color-mode="light"] { + --header-background: #4ec58a; + --header-font-color: #ffffff; + + --body-background: #ffffff; + --body-font-color: #343a40; + + --mark-color: #ffab00; + + --button-background: #62cb97; + --button-border-color: #4ec58a; + + --link-color: #518169; + --link-color-visited: #c54e8a; + + --code-background: #f5f6f8; + --code-accent-color: #e3e7eb; + --code-accent-color-lite: #eff1f3; + + --code-copy-font-color: #6b7784; + --code-copy-border-color: #adb4bc; + --code-copy-success-color: #00c853; + + --accent-color-dark: #868e96; + --accent-color: #e9ecef; + --accent-color-lite: #f8f9fa; + + --control-icons: #b2bac1; + + --footer-background: #2f333e; + --footer-font-color: #ffffff; + --footer-link-color: #ffcc5c; + --footer-link-color-visited: #ffcc5c; +} +@media (prefers-color-scheme: light) { + :root { + --header-background: #4ec58a; + --header-font-color: #ffffff; + + --body-background: #ffffff; + --body-font-color: #343a40; + + --mark-color: #ffab00; + + --button-background: #62cb97; + --button-border-color: #4ec58a; + + --link-color: #518169; + --link-color-visited: #c54e8a; + + --code-background: #f5f6f8; + --code-accent-color: #e3e7eb; + --code-accent-color-lite: #eff1f3; + + --code-copy-font-color: #6b7784; + --code-copy-border-color: #adb4bc; + --code-copy-success-color: #00c853; + + --accent-color-dark: #868e96; + --accent-color: #e9ecef; + --accent-color-lite: #f8f9fa; + + --control-icons: #b2bac1; + + --footer-background: #2f333e; + --footer-font-color: #ffffff; + --footer-link-color: #ffcc5c; + --footer-link-color-visited: #ffcc5c; + } +} + +/* Dark mode theming */ +:root[color-mode="dark"] { + --header-background: #4ec58a; + --header-font-color: #ffffff; + + --body-background: #343a40; + --body-font-color: #ced3d8; + + --mark-color: #ffab00; + + --button-background: #62cb97; + --button-border-color: #4ec58a; + + --link-color: #7ac29e; + --link-color-visited: #c27a9e; + + --code-background: #2f353a; + --code-accent-color: #262b2f; + --code-accent-color-lite: #2b3035; + + --code-copy-font-color: #adb4bc; + --code-copy-border-color: #808c98; + --code-copy-success-color: #00c853; + + --accent-color-dark: #222629; + --accent-color: #2b3035; + --accent-color-lite: #2f353a; + + --control-icons: #b2bac1; + + --footer-background: #2f333e; + --footer-font-color: #ffffff; + --footer-link-color: #ffcc5c; + --footer-link-color-visited: #ffcc5c; +} +@media (prefers-color-scheme: dark) { + :root { + --header-background: #4ec58a; + --header-font-color: #ffffff; + + --body-background: #343a40; + --body-font-color: #ced3d8; + + --mark-color: #ffab00; + + --button-background: #62cb97; + --button-border-color: #4ec58a; + + --link-color: #7ac29e; + --link-color-visited: #c27a9e; + + --code-background: #2f353a; + --code-accent-color: #262b2f; + --code-accent-color-lite: #2b3035; + + --code-copy-font-color: #adb4bc; + --code-copy-border-color: #808c98; + --code-copy-success-color: #00c853; + + --accent-color-dark: #222629; + --accent-color: #2b3035; + --accent-color-lite: #2f353a; + + --control-icons: #b2bac1; + + --footer-background: #2f333e; + --footer-font-color: #ffffff; + --footer-link-color: #ffcc5c; + --footer-link-color-visited: #ffcc5c; + } +} diff --git a/images/readme.png b/images/readme.png index 7092677..51e02ef 100644 Binary files a/images/readme.png and b/images/readme.png differ diff --git a/images/screenshot-plain.png b/images/screenshot-plain.png deleted file mode 100644 index 3573d49..0000000 Binary files a/images/screenshot-plain.png and /dev/null differ diff --git a/images/screenshot.png b/images/screenshot.png index b570a71..737391c 100644 Binary files a/images/screenshot.png and b/images/screenshot.png differ diff --git a/images/tn.png b/images/tn.png index 3ea8daf..1da2116 100644 Binary files a/images/tn.png and b/images/tn.png differ diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html index 035927e..9660710 100644 --- a/layouts/_default/baseof.html +++ b/layouts/_default/baseof.html @@ -16,7 +16,7 @@ {{ partial "svg-icon-symbols" . }} -
+
{{ partial "site-header" . }}
diff --git a/layouts/partials/content.html b/layouts/partials/content.html index c35e992..0aff871 100644 --- a/layouts/partials/content.html +++ b/layouts/partials/content.html @@ -1 +1,4 @@ -{{ .Content | replaceRE `` `` | safeHTML }} +{{- $content := .Content -}} +{{- $content = $content | replaceRE `` `` | safeHTML -}} +{{- $content = $content | replaceRE `((?:.|\n)+?
)` `
${1}
` | safeHTML -}} +{{- $content -}} diff --git a/layouts/partials/head/others.html b/layouts/partials/head/others.html index 6349e30..eb6086d 100644 --- a/layouts/partials/head/others.html +++ b/layouts/partials/head/others.html @@ -1,3 +1,5 @@ + + diff --git a/layouts/partials/site-header.html b/layouts/partials/site-header.html index bf9a6d5..ffe4ad1 100644 --- a/layouts/partials/site-header.html +++ b/layouts/partials/site-header.html @@ -1,14 +1,33 @@
-
- - - - {{ .Site.Title }} +
+
+
+
+ + + {{ i18n "button_toggle_dark" }} + + + + {{ i18n "button_toggle_dark" }} + + + + {{ i18n "button_toggle_dark" }} + + - {{ with .Site.Params.subtitle }} - {{ . }} - {{ end }} - +