Skip to content

Commit 6319e06

Browse files
committed
added back themes
1 parent 119b7ff commit 6319e06

File tree

433 files changed

+34267
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

433 files changed

+34267
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# wowchemy-core
2+
3+
Core Wowchemy utilities and integrations.
4+
5+
A module for commonalities between the `wowchemy` (Bootstrap) and `wowchemy-tailwind` (Tailwind) UIs.
6+
7+
## Uses
8+
9+
Used in the following modules:
10+
11+
- wowchemy-seo
12+
- wowchemy
13+
- wowchemy-tailwind
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module:
2+
mounts:
3+
- source: layouts
4+
target: layouts
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module github.com/wowchemy/wowchemy-hugo-themes/modules/wowchemy-core
2+
3+
go 1.15
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{{/* Get name of primary author. */}}
2+
3+
{{ $page := . }}
4+
5+
{{/* Get publisher as fall back. */}}
6+
{{ $publisher := site.Params.marketing.seo.org_name | default site.Title }}
7+
8+
{{ $author := "" }}
9+
{{ $author_username := "" }}
10+
11+
{{ if and (not $page.Params.authors) ($page.Scratch.Get "superuser_username") }}
12+
{{ $author_username = $page.Scratch.Get "superuser_username" }}
13+
{{ else if $page.Params.authors }}
14+
{{ $author = index $page.Params.authors 0 }}
15+
{{ $author_username = urlize $author }}
16+
{{ end }}
17+
18+
{{ $taxonomy := "authors" }}
19+
{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_username) }}
20+
{{ with $profile_page }}
21+
{{ $author = .Title }}
22+
{{ else }}
23+
{{ $author = $author | default $publisher }}
24+
{{ end }}
25+
26+
{{ return $author }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{{/* Function to retrieve the featured image */}}
2+
{{/* Inputs: page context */}}
3+
{{/* Output: image resource, or nil if not found */}}
4+
5+
{{/*
6+
Featured image is searched in this order:
7+
1. Search for a file `*featured*` in the post directory
8+
2. Search for a file `.Params.image.filename` in the post directory
9+
3. Search for a file `.Params.image.filename` in the `assets/media/` directory
10+
*/}}
11+
12+
{{/* Search for an image "*featured*" in post folder */}}
13+
{{ $resource := (.Resources.ByType "image").GetMatch "*featured*" }}
14+
{{ if eq $resource nil }}
15+
{{/* Otherwise fall back the image file specified in front matter */}}
16+
{{ $filename := .Params.image.filename }}
17+
{{/* Search in post folder */}}
18+
{{ $resource = (.Resources.ByType "image").GetMatch $filename }}
19+
{{/* Otherwise in `assets/media/` folder */}}
20+
{{ if eq $resource nil }} {{ $resource = resources.GetMatch (path.Join "media" $filename) }} {{ end }}
21+
{{ end }}
22+
23+
{{ return $resource }}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{{/* Function to inject custom code into layouts without overriding files. */}}
2+
{{/* Input: hook folder name (str) */}}
3+
{{/* Output: loaded (bool) */}}
4+
5+
{{ $loaded := false }}
6+
{{ $partial_dir := printf "hooks/%s/" .hook }}
7+
{{ $context := .context }}
8+
{{ $hook_dir_path := path.Join "layouts/partials" $partial_dir }}
9+
{{ if fileExists $hook_dir_path }}
10+
{{ range os.ReadDir $hook_dir_path }}
11+
{{ if not .IsDir }}
12+
{{ $partial_path := path.Join $partial_dir .Name }}
13+
{{ partial $partial_path $context }}
14+
{{ $loaded = true }}
15+
{{ end }}
16+
{{ end }}
17+
{{ end }}
18+
{{/* The return statement below is for debug purposes only and prevents the above partial(s) being included in the page */}}
19+
{{/* return $loaded */}}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{{/* Function to get website icon image. */}}
2+
{{/* Input: size (int) */}}
3+
{{/* Output: resource (obj) */}}
4+
5+
{{ $icon := resources.GetMatch "media/icon.png" }}
6+
{{ $icon_resized := $icon.Fill (printf "%sx%s Center" (string .) (string .)) }}
7+
{{ return $icon_resized }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{{/* Function to get logo image. */}}
2+
{{/* Inputs: constraint: max_height/fit (str); size (int) */}}
3+
{{/* Output: resource (obj) */}}
4+
5+
{{/* Workaround fact Hugo does not support GetMatch in assets dir */}}
6+
{{/* Hugo doesn't support image ops on SVG: https://discourse.gohugo.io/t/ho-do-i-convert-a-generic-resource-to-image-resource/22570/4 */}}
7+
{{ $logo := resources.Get "media/logo.png" | default (resources.Get "media/logo.svg") }}
8+
{{ $logo_proc := $logo }}
9+
10+
{{/* If the type of image can be resized by Hugo, resize it given a `.size` argument to the function. */}}
11+
{{ if resources.Get "media/logo.png" }}
12+
{{ if eq .constraint "max_height" }}
13+
{{/* Resize logo to fit specified max height. */}}
14+
{{ $logo_proc = ($logo.Resize (printf "x%s" (string .size))) }}
15+
{{ else }}
16+
{{/* Constrain logo to fit within specified dimensions. */}}
17+
{{ $logo_proc = ($logo.Fit (printf "%sx%s" (string .size) (string .size))) }}
18+
{{ end }}
19+
{{ end }}
20+
21+
{{ return $logo_proc }}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{/* Function to get logo URL for JSONLD. */}}
2+
{{/* Inputs: page context */}}
3+
{{/* Output: logo URL (URL) */}}
4+
5+
{{ $logo_url := "" }}
6+
{{ if resources.Get "media/logo.png" | or (resources.Get "media/logo.svg") }}
7+
{{ $logo_url = (partial "functions/get_logo" (dict "constraint" "fit" "size" 192)).Permalink }}
8+
{{ else }}
9+
{{ $logo_url = (partial "functions/get_icon" 192).Permalink }}
10+
{{ end }}
11+
12+
{{ return $logo_url }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{{ $title := "" }}
2+
{{ with .Params.seo.title }}
3+
{{ $title = replace . "{brand}" site.Title }}
4+
{{ else }}
5+
{{ $title = .Title | default site.Title }}
6+
{{ if ne $title site.Title }}{{ $title = printf "%s | %s" $title site.Title }}{{ end }}
7+
{{ end }}
8+
{{ return $title }}

0 commit comments

Comments
 (0)