From 4bfc17ac9d2fe11673b4fd2142a3c73711377aa4 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Mon, 27 Sep 2021 22:47:13 +0200 Subject: [PATCH] chore: normalize default favicons and add docs (#213) --- .dictionary | 2 + .../content/features/theming/_index.md | 46 +++++++++++++++++++ gulpfile.js | 11 ++++- layouts/partials/head/favicons.html | 4 +- 4 files changed, 61 insertions(+), 2 deletions(-) diff --git a/.dictionary b/.dictionary index 079d263..acee446 100644 --- a/.dictionary +++ b/.dictionary @@ -27,3 +27,5 @@ relref href KaTeX katex +Theming +Favicon[s]? diff --git a/exampleSite/content/features/theming/_index.md b/exampleSite/content/features/theming/_index.md index 482f32a..eb850fa 100644 --- a/exampleSite/content/features/theming/_index.md +++ b/exampleSite/content/features/theming/_index.md @@ -1,3 +1,11 @@ +--- +title: Theming +--- + +{{< 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. @@ -12,4 +20,42 @@ All the necessary CSS customization properties are listed below. If you want to +## 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. + + +```tpl + + + +``` + +### Simple replacement + +The minimal steps to load a custom Favicon is to overwrite tree default Favicon files. Therefor place these files into your projects root folder: + +- `static/favicon/favicon.svg` +- `static/favicon/favicon-32x32.png` +- `static/favicon/favicon-16x16.png` + +### Full replacement + +If you want to add more Favicon formats you have to [overwrite](https://gohugo.io/templates/partials/#partial-template-lookup-order) the default partial that is used to load the files. In the next step you have to place the required files in the `static` folder of your project as well. + +**Example:** + + +```tpl + + + + + + + + + +``` + Happy customizing! diff --git a/gulpfile.js b/gulpfile.js index 349f16b..8cbcdc2 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -50,6 +50,13 @@ gulp.task("sass", function () { .pipe(gulp.dest(CSS_BUILD)); }); +gulp.task("favicon-svg", function () { + return gulp + .src("src/favicon/favicon-master.svg") + .pipe(rename("favicon.svg")) + .pipe(gulp.dest("static/favicon/")); +}); + gulp.task("favicon-generate", function (done) { realFavicon.generateFavicon( { @@ -309,6 +316,8 @@ gulp.task( gulp.series("asset-sync-font", "asset-sync-css", "asset-sync-js", "asset-rev") ); +gulp.task("favicon", gulp.series("favicon-svg", "favicon-generate")); + gulp.task("svg", gulp.series("svg-sprite")); gulp.task( @@ -321,7 +330,7 @@ gulp.task( devBuild ? "asset-map" : [], "svg", "iconfont", - "favicon-generate", + "favicon", ]) ); diff --git a/layouts/partials/head/favicons.html b/layouts/partials/head/favicons.html index 4326806..1ac070b 100644 --- a/layouts/partials/head/favicons.html +++ b/layouts/partials/head/favicons.html @@ -1 +1,3 @@ - + + +