diff --git a/.dictionary b/.dictionary index 3ca794d..606e2fe 100644 --- a/.dictionary +++ b/.dictionary @@ -14,3 +14,4 @@ GPL IcoMoon YAML ok +FontAwesome diff --git a/.drone.yml b/.drone.yml index b6df955..4ea2024 100644 --- a/.drone.yml +++ b/.drone.yml @@ -12,6 +12,7 @@ steps: commands: - npm install > /dev/null - npx gulp default + - npx gulp svg-sprite-list environment: FORCE_COLOR: true NPM_CONFIG_LOGLEVEL: error @@ -91,6 +92,7 @@ steps: commands: - npm install > /dev/null - npx gulp default + - npx gulp svg-sprite-list environment: FORCE_COLOR: true NPM_CONFIG_LOGLEVEL: error @@ -269,6 +271,6 @@ depends_on: --- kind: signature -hmac: 0b3fb338632d237c7279a218b7bd1b3793aeb15cd8382b8c804a5e2da9a30534 +hmac: 14dcf0dc7a6960b86289fd9b6a530c96ed121393661dec857f5fd64c39ded614 ... diff --git a/.gitignore b/.gitignore index 86db449..7f347e5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,7 +10,7 @@ exampleSite/public/ CHANGELOG.md # auto-generated files -layouts/partials/icons-svg-symbols.html +assets/sprites/ assets/*.css static/*.css !static/custom.css @@ -19,6 +19,7 @@ static/favicon/ static/fonts/GeekdocIcons.* resources/ exampleSite/resources/ +exampleSite/data/sprites/ data/assets.json diff --git a/exampleSite/assets/sprites/regular.svg b/exampleSite/assets/sprites/regular.svg new file mode 100644 index 0000000..2edd1f7 --- /dev/null +++ b/exampleSite/assets/sprites/regular.svg @@ -0,0 +1,462 @@ + + diff --git a/exampleSite/content/shortcodes/icon.md b/exampleSite/content/shortcodes/icon.md new file mode 100644 index 0000000..6db31b3 --- /dev/null +++ b/exampleSite/content/shortcodes/icon.md @@ -0,0 +1,15 @@ +Simple shortcode to include icons from SVG sprites outside of menus. + +```tpl +{{* icon "thumbs-up" */>}} +``` + +**Example:** + +| Result | Usage | +| -------------------------- | -------------------------------- | +| {{< icon "thumbs-up" >}} | `{{* icon "thumbs-up" */>}}` | +| {{< icon "thumbs-down" >}} | `{{* icon "thumbs-down" */>}}` | +| {{< icon "laugh" >}} | `{{* icon "laugh" */>}}` | +| {{< icon "lemon" >}} | `{{* icon "lemon" */>}}` | +| {{< icon "moon" >}} | `{{* icon "moon" */>}}` | diff --git a/exampleSite/content/shortcodes/includes.md b/exampleSite/content/shortcodes/includes.md index fb428b6..6628d3e 100644 --- a/exampleSite/content/shortcodes/includes.md +++ b/exampleSite/content/shortcodes/includes.md @@ -8,16 +8,16 @@ Include shortcode can include files of different types. By specifying a language Attributes: - -| Name | Usage | default | -|---|---|---| -| file | path to the included file relative to the hugo root | empty value | -| language* | language for [syntax highlighting](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages) | empty value | -| markdown | included file is markdown | false | -| options | highlighting [options](https://gohugo.io/content-management/syntax-highlighting/#highlight-shortcode) | linenos=table | +| Name | Usage | default | +| ---------- | ----------------------------------------------------------------------------------------------------------------------------------- | ------------- | +| file | path to the included file relative to the hugo root | empty value | +| language\* | language for [syntax highlighting](https://gohugo.io/content-management/syntax-highlighting/#list-of-chroma-highlighting-languages) | empty value | +| markdown | included file is markdown | false | +| options | highlighting [options](https://gohugo.io/content-management/syntax-highlighting/#highlight-shortcode) | linenos=table | \* if not set, the content will be rendered as plain HTML + ### Include \*.yml file with options ```tpl diff --git a/exampleSite/content/usage/icons.md b/exampleSite/content/usage/icons.md new file mode 100644 index 0000000..e8b2d09 --- /dev/null +++ b/exampleSite/content/usage/icons.md @@ -0,0 +1,52 @@ +--- +title: Icons +--- + + + +{{< toc >}} + + + +## Custom icons + +The only supported source for custom icons are SVG sprites. Some icon frameworks provides ready to use sprites e.g. FontAwesome. If the framework don't provide sprites, you can create your own from raw SVG icons. There are a lot of tools available to create sprites, please choose one that fits your need. One solution could be [svgsprit.es](https://svgsprit.es/). + +Regardless of which tool (or existing sprite) you choose, there are a few requirements that must be met: + +1. The sprite must be a valid **SVG** file. +2. You have to ensure to **hide the sprite**. Apply the predefined class `svg-sprite` or `hidden` to the root element of your sprite or add a small piece of inline CSS e.g. `style="display: none;"`. +3. Save the sprite to the folder `assets/sprites` right beside your `content` folder. + +The result of a valid minimal SVG sprite file could look like this: + +```XML + +``` + +**Example:** + +FontAwesome provides three pre-build sprites included in the regular Web download pack, `sprites/brands.svg`, `sprites/regular.svg` and `sprites/solid.svg`. Choose your sprite to use and copy it to your projects root directory into `assets/sprites`, right beside your `content` folder. The result should look like this: + +```Bash +my_projcet/ +├── assets +│ └── sprites +│ └── regular.svg +├── config.yaml +├── content +│ ├── _index.md +│ ├── ... +``` + +That's it! The theme will auto-load all available SVG sprites provided in the assets folder. To use the icons e.g. in the [bundle menu](/usage/menus/#bundle-menu), you need to lookup the id of the icon. An example would be `thumbs-up` {{< icon "thumbs-up" >}}. There is also a [shortcode](/shortcodes/icon/) available. + +## Build-in icons + +The theme bundles just a small set of hand crafted icons. + +{{< sprites >}} diff --git a/exampleSite/content/usage/menus.md b/exampleSite/content/usage/menus.md index 6e50ff4..5d54a5d 100644 --- a/exampleSite/content/usage/menus.md +++ b/exampleSite/content/usage/menus.md @@ -62,7 +62,7 @@ main: ref: "/level-2/level-2-2" ``` -As an advantage you can add icons to your menu entries e.g. `icon: "notification"`. +As an advantage you can add [icons](/usage/icons/) to your menu entries e.g. `icon: "notification"`. [![Example bundle menu](/media/bundle-menu.png)](/media/bundle-menu.png) diff --git a/exampleSite/data/menu/more.yaml b/exampleSite/data/menu/more.yaml index d06cadb..04d7c61 100644 --- a/exampleSite/data/menu/more.yaml +++ b/exampleSite/data/menu/more.yaml @@ -2,12 +2,12 @@ more: - name: News ref: "/posts" - icon: "notification" + icon: "gdoc_notification" - name: Releases ref: "https://github.com/thegeeklab/hugo-geekdoc/releases" external: true - icon: "download" + icon: "gdoc_download" - name: "View Source" ref: "https://github.com/thegeeklab/hugo-geekdoc" external: true - icon: "github" + icon: "gdoc_github" diff --git a/exampleSite/layouts/shortcodes/sprites.html b/exampleSite/layouts/shortcodes/sprites.html new file mode 100644 index 0000000..fd3a6e0 --- /dev/null +++ b/exampleSite/layouts/shortcodes/sprites.html @@ -0,0 +1,12 @@ +