diff options
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/shortcodes/chroma-lexers.html | 6 | ||||
-rw-r--r-- | layouts/shortcodes/datatable-filtered.html | 28 | ||||
-rw-r--r-- | layouts/shortcodes/imgproc.html | 25 | ||||
-rw-r--r-- | layouts/shortcodes/new-in.html | 13 | ||||
-rw-r--r-- | layouts/shortcodes/page-kinds.html | 7 |
5 files changed, 79 insertions, 0 deletions
diff --git a/layouts/shortcodes/chroma-lexers.html b/layouts/shortcodes/chroma-lexers.html new file mode 100644 index 0000000..0df2b86 --- /dev/null +++ b/layouts/shortcodes/chroma-lexers.html @@ -0,0 +1,6 @@ +<dl> +{{ range .Site.Data.docs.chroma.lexers }} +<dt>{{ .Name }}</dt> +<dd>{{ delimit .Aliases ", " }}</dd> +{{ end }} +</dl>
\ No newline at end of file diff --git a/layouts/shortcodes/datatable-filtered.html b/layouts/shortcodes/datatable-filtered.html new file mode 100644 index 0000000..576ddab --- /dev/null +++ b/layouts/shortcodes/datatable-filtered.html @@ -0,0 +1,28 @@ +{{ $package := (index .Params 0) }} +{{ $listname := (index .Params 1) }} +{{ $filter := split (index .Params 2) " " }} +{{ $filter1 := index $filter 0 }} +{{ $filter2 := index $filter 1 }} +{{ $filter3 := index $filter 2 }} + +{{ $list := (index (index .Site.Data.docs $package) $listname) }} +{{ $fields := after 3 .Params }} +{{ $list := where $list $filter1 $filter2 $filter3 }} + +<table class="table table-bordered"> + <tr> + {{ range $fields }} + <th>{{ . }}</th> + {{ end }} + </tr> + {{ range $list }} + <tr> + {{ range $k, $v := . }} + {{ $.Scratch.Set $k $v }} + {{ end }} + {{ range $fields }} + <td>{{ $.Scratch.Get . }}</td> + {{ end }} + </tr> + {{ end }} +</table> diff --git a/layouts/shortcodes/imgproc.html b/layouts/shortcodes/imgproc.html new file mode 100644 index 0000000..1cb5f49 --- /dev/null +++ b/layouts/shortcodes/imgproc.html @@ -0,0 +1,25 @@ +{{ $original := .Page.Resources.GetMatch (printf "*%s*" (.Get 0)) }} +{{ $command := .Get 1 }} +{{ $options := .Get 2 }} +{{ if eq $command "Fit"}} +{{ .Scratch.Set "image" ($original.Fit $options) }} +{{ else if eq $command "Resize"}} +{{ .Scratch.Set "image" ($original.Resize $options) }} +{{ else if eq $command "Fill"}} +{{ .Scratch.Set "image" ($original.Fill $options) }} +{{ else }} +{{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize."}} +{{ end }} +{{ $image := .Scratch.Get "image" }} +<figure style="padding: 0.25rem; margin: 2rem 0; background-color: #cccc"> + <img style="max-width: 100%; width: auto; height: auto;" src="{{ $image.RelPermalink }}" width="{{ $image.Width }}" height="{{ $image.Height }}"> + <figcaption> + <small> + {{ with .Inner }} + {{ . }} + {{ else }} + .{{ $command }} "{{ $options }}" + {{ end }} + </small> + </figcaption> +</figure> diff --git a/layouts/shortcodes/new-in.html b/layouts/shortcodes/new-in.html new file mode 100644 index 0000000..d262337 --- /dev/null +++ b/layouts/shortcodes/new-in.html @@ -0,0 +1,13 @@ +{{ $version := .Get 0 }} +{{ if not $version }} + {{ errorf "Missing version in new-in shortcode "}} +{{ end }} +{{ $version = $version | strings.TrimPrefix "v" }} +<span class="m-1 inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-green-100 text-limegreen-600"> + <svg class="mr-1.5 h-2 w-2" fill="currentColor" viewBox="0 0 8 8"> + <circle cx="4" cy="4" r="3" /> + </svg> + <a class="no-underline text-limegreen-700 hover:text-limegreen-900" href="{{ printf "https://gohugo.io/news/%s-relnotes/" $version }}" target="_blank"> + New in v{{$version}} + </a> +</span>
\ No newline at end of file diff --git a/layouts/shortcodes/page-kinds.html b/layouts/shortcodes/page-kinds.html new file mode 100644 index 0000000..968a7a5 --- /dev/null +++ b/layouts/shortcodes/page-kinds.html @@ -0,0 +1,7 @@ +| Kind | Description | Example | +|----------------|--------------------------------------------------------------------|-------------------------------------------------------------------------------| +| `home` | The landing page for the home page | `/index.html` | +| `page` | The landing page for a given page | `my-post` page (`/posts/my-post/index.html`) | +| `section` | The landing page of a given section | `posts` section (`/posts/index.html`) | +| `taxonomy` | The landing page for a taxonomy | `tags` taxonomy (`/tags/index.html`) | +| `term` | The landing page for one taxonomy's term | term `awesome` in `tags` taxonomy (`/tags/awesome/index.html`) | |