diff options
author | Gianmarco Brocchi <gianmarcobrocchi@gmail.com> | 2020-10-04 05:27:29 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-04 05:27:29 +0300 |
commit | ca79e478af03c0f387b9ae506b5cad7316724944 (patch) | |
tree | fbf9f292f413dcb4b95b2f30c1482033c3cebcc6 | |
parent | cba6b1861f64ec050f27c53b68b0e8f88f777414 (diff) |
Add fileRel (#15)
* Add fileRel
Add shortcode to link a file
* Add fileRel to the documented list of shortcodes
* Update layouts/shortcodes/fileRel.html
Set empty string as default
Co-authored-by: zwbetz-gh <37317628+zwbetz-gh@users.noreply.github.com>
* add inner spacing to double curly brackets around $name to be consistent
Co-authored-by: zwbetz-gh <37317628+zwbetz-gh@users.noreply.github.com>
Co-authored-by: zwbetz-gh <37317628+zwbetz-gh@users.noreply.github.com>
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | layouts/shortcodes/fileRel.html | 6 |
2 files changed, 22 insertions, 0 deletions
@@ -23,6 +23,7 @@ A minimal hugo theme made with bootstrap that focuses on content readability. - [`imgRel`](#imgrel) - [`imgProc`](#imgproc) - [`mastodon`](#mastodon) + - [`fileRel`](#fileRel) - [Getting help](#getting-help) ## Demo @@ -162,6 +163,21 @@ status="https://mastodon.social/@kevingimbel/100700713283716694" width="1000" height="500" %}} ``` +### `fileRel` + +This will insert a link to a file by relative path into your content. +To use it, pass the `pathURL` of your file. + +The arguments `class` and `style` are optional. + +``` +{{< fileRel + pathURL="files/file.pdf" + name="filename" + class="someclass" + style="somestyle" >}}, +``` + ## Getting help If you run into an issue that isn't answered by this documentation or the [`exampleSite`](https://github.com/zwbetz-gh/minimal-bootstrap-hugo-theme/tree/master/exampleSite), then visit the [Hugo forum](https://discourse.gohugo.io/). The folks there are helpful and friendly. **Before** asking your question, be sure to read the [requesting help guidelines](https://discourse.gohugo.io/t/requesting-help/9132). diff --git a/layouts/shortcodes/fileRel.html b/layouts/shortcodes/fileRel.html new file mode 100644 index 0000000..1fa41c0 --- /dev/null +++ b/layouts/shortcodes/fileRel.html @@ -0,0 +1,6 @@ +{{- $pathURL := .Get "pathURL" -}} +{{- $name := .Get "name" -}} +{{- $class := .Get "class" | default "" -}} +{{- $style := .Get "style" | default "" -}} + +<a class="{{ $class }}" style="{{ $style | safeCSS }}" href="{{ $pathURL | relURL }}">{{ $name }}</a> |