diff options
author | Zachary Betz <zwbetz@gmail.com> | 2018-12-06 23:18:36 +0300 |
---|---|---|
committer | Zachary Betz <zwbetz@gmail.com> | 2018-12-06 23:18:36 +0300 |
commit | 657cd345f9dc89db1d07f85afe781482179f6ac3 (patch) | |
tree | 4fa81aa1128c20ed04cb3e9bf9fd7668f7bf222e | |
parent | 74db2c484e40eacd47a11a8deb4caf88b4cec2bb (diff) |
Update docs, add imgProc shortcode
-rw-r--r-- | README.md | 77 | ||||
-rw-r--r-- | layouts/shortcodes/imgProc.html | 23 | ||||
-rw-r--r-- | theme.toml | 2 |
3 files changed, 90 insertions, 12 deletions
@@ -18,12 +18,18 @@ Demos: * [Screenshot](#screenshot) * [Hugo Version](#hugo-version) * [Installation Options](#installation-options) + * [Add it as a Git Submodule](#add-it-as-a-git-submodule) + * [Download a Zip and Unzip it](#download-a-zip-and-unzip-it) + * [Update the Config File after Installing](#update-the-config-file-after-installing) * [Update Options](#update-options) + * [Git Submodule](#git-submodule) + * [Zip](#zip) * [Site Layout](#site-layout) * [Example config.toml](#example-configtoml) * [config.toml Options](#configtoml-options) * [Theme](#theme) * [Enable Git Info](#enable-git-info) + * [Taxonomies](#taxonomies) * [Description](#description) * [Content Background Color](#content-background-color) * [Content Text Color](#content-text-color) @@ -54,6 +60,7 @@ Demos: * [blockquote](#blockquote) * [imgAbs](#imgabs) * [imgRel](#imgrel) + * [imgProc](#imgproc) * [Getting Help](#getting-help) * [Contribution](#contribution) @@ -67,13 +74,18 @@ This theme requires hugo version `0.48` or above. Take a look at the [hugo relea ## Installation Options -1. Add it as a git submodule - 1. `cd YOUR_SITE` - 1. `git submodule add https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme.git themes/minimal-bootstrap-hugo-theme` -1. Download a zip and unzip it - 1. [Download a zip of the theme from GitHub](https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme/archive/master.zip) - 1. Unzip it into `YOUR_SITE/themes/` - 1. Once unzipped, it will be named `minimal-bootstrap-hugo-theme-master`. Rename it to `minimal-bootstrap-hugo-theme` +### Add it as a Git Submodule + +1. `cd YOUR_SITE` +1. `git submodule add https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme.git themes/minimal-bootstrap-hugo-theme` + +### Download a Zip and Unzip it + +1. [Download a zip of the theme from GitHub](https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme/archive/master.zip) +1. Unzip it into `YOUR_SITE/themes/` +1. Once unzipped, it will be named `minimal-bootstrap-hugo-theme-master`. Rename it to `minimal-bootstrap-hugo-theme` + +### Update the Config File after Installing Once installed, add this line to your `config.toml`: @@ -83,11 +95,15 @@ theme = "minimal-bootstrap-hugo-theme" ## Update Options +### Git Submodule + If you used the git submodule option to install the theme, update it by running: 1. `cd YOUR_SITE` 1. `git submodule foreach git pull origin master` +### Zip + If you downloaded a zip to install the theme, just do those installation steps again to update it. ## Site Layout @@ -187,6 +203,15 @@ enableGitInfo = false * If set to `false`, `lastmod` date will pull from front matter * See [Front Matter Dates](#front-matter-dates) for more info +### Taxonomies + +``` +[taxonomies] + tag = "tags" +``` +* **Required** +* Setup tags + ### Description ``` @@ -422,18 +447,48 @@ I am beginning to learn that it is the sweet, **simple** things of life which ar ### `imgAbs` -This will insert an image into your content by absolute path. To use it, pass the `pathURL` of your image. These arguments are optional: `alt`, `class`, `style`. +This will insert an image into your content by absolute path. To use it, pass the `pathURL` of your image. + +These arguments are optional: `alt`, `class`, `style`. ``` -{{< imgAbs pathURL="img/some-img.png" alt="Some description" class="some-class" style="some-style" >}} +{{< imgAbs +pathURL="img/some-img.png" +alt="Some description" +class="some-class" +style="some-style" >}} ``` ### `imgRel` -This will insert an image into your content by relative path. To use it, pass the `pathURL` of your image. These arguments are optional: `alt`, `class`, `style`. +This will insert an image into your content by relative path. To use it, pass the `pathURL` of your image. + +These arguments are optional: `alt`, `class`, `style`. + +``` +{{< imgRel +pathURL="img/some-img.png" +alt="Some description" +class="some-class" +style="some-style" >}} +``` + +### `imgProc` + +This will process an image from a [page bundle](https://gohugo.io/content-management/page-bundles/). To use it, pass the image name (`img`), command (`command`), and command options (`options`). + +The `command` argument will be on of: `Resize`, `Fit`, `Fill`. See the [image processing](https://gohugo.io/content-management/image-processing/) docs for a deeper dive. + +These arguments are optional: `alt`, `class`, `style`. ``` -{{< imgRel pathURL="img/some-img.png" alt="Some description" class="some-class" style="some-style" >}} +{{< imgProc +img="some-img.png" +command="Resize" +options="800x" +alt="Some description" +class="some-class" +style="some-style" >}} ``` ## Getting Help diff --git a/layouts/shortcodes/imgProc.html b/layouts/shortcodes/imgProc.html new file mode 100644 index 0000000..8923ef1 --- /dev/null +++ b/layouts/shortcodes/imgProc.html @@ -0,0 +1,23 @@ +{{- $img := .Get "img" -}} +{{- $command := .Get "command" -}} +{{- $options := .Get "options" -}} +{{- $alt := .Get "alt" -}} +{{- $class := .Get "class" -}} +{{- $style := .Get "style" -}} + +{{- $original := .Page.Resources.GetMatch (printf "*%s*" $img) -}} +{{- $new := "" -}} + +{{- if eq $command "Fit"}} + {{- $new = $original.Fit $options -}} +{{- else if eq $command "Resize"}} + {{- $new = $original.Resize $options -}} +{{- else if eq $command "Fill"}} + {{- $new = $original.Fill $options -}} +{{- else -}} + {{- errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}} +{{- end -}} + +<a href="{{ $original.Permalink }}"> + <img src="{{ $new.Permalink }}" alt="{{ $alt }}" class="{{ $class }}" style="{{ $style | safeCSS }}"> +</a> @@ -7,7 +7,7 @@ licenselink = "https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme/blob/ma description = "A minimal hugo theme made with bootstrap that focuses on content readability" homepage = "https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme" tags = ["minimalist", "blog", "clean", "simple", "bootstrap"] -features = ["responsive", "small page size", "google analytics", "cookie consent"] +features = ["responsive", "small page size", "google analytics", "cookie consent", "tags"] min_version = 0.48 [author] |