diff options
Diffstat (limited to 'themes/terminal/layouts')
22 files changed, 581 insertions, 0 deletions
diff --git a/themes/terminal/layouts/404.html b/themes/terminal/layouts/404.html new file mode 100644 index 0000000..e680954 --- /dev/null +++ b/themes/terminal/layouts/404.html @@ -0,0 +1,10 @@ +{{ define "main" }} + <div class="post"> + <h1 class="post-title">404 — {{ $.Site.Params.missingContentMessage | default "Page not found..." }}</h1> + + <div class="post-content"> + <a href="{{ "/" | absURL }}">{{ $.Site.Params.missingBackButtonLabel | default "Back to home page" }} →</a> + </div> + + </div> +{{ end }} diff --git a/themes/terminal/layouts/_default/baseof.html b/themes/terminal/layouts/_default/baseof.html new file mode 100644 index 0000000..ae3b9cc --- /dev/null +++ b/themes/terminal/layouts/_default/baseof.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> +<html lang="{{ $.Site.Language }}"> +<head> + {{ block "title" . }} + <title>{{ if .IsHome }}{{ $.Site.Title }}{{ else }}{{ .Title }} :: {{ $.Site.Title }}{{ end }}</title> + {{ end }} + {{ partial "head.html" . }} +</head> +<body class="{{- ( or .Params.color $.Site.Params.ThemeColor ) -}}"> +{{ $container := cond ($.Site.Params.FullWidthTheme | default false) "container full" (cond ($.Site.Params.CenterTheme | default false) "container center" "container") }} + +<div class="{{- $container -}}{{- cond ($.Site.Params.oneHeadingSize | default true) " headings--one-size" "" }}"> + + {{ partial "header.html" . }} + + <div class="content"> + {{ block "main" . }} + {{ end }} + </div> + + {{ block "footer" . }} + {{ partial "footer.html" . }} + {{ end }} +</div> + +</body> +</html> diff --git a/themes/terminal/layouts/_default/index.html b/themes/terminal/layouts/_default/index.html new file mode 100644 index 0000000..1cab615 --- /dev/null +++ b/themes/terminal/layouts/_default/index.html @@ -0,0 +1,65 @@ +{{ define "main" }} + {{ if .Content }} + <div class="index-content {{ if .Params.framed -}}framed{{- end -}}"> + {{ .Content }} + </div> + {{ end }} + <div class="posts"> + {{ $isntDefault := not (or (eq (trim $.Site.Params.contentTypeName " ") "posts") (eq (trim $.Site.Params.contentTypeName " ") "")) }} + {{ $contentTypeName := cond $isntDefault (string $.Site.Params.contentTypeName) "posts" }} + + {{ $PageContext := . }} + {{ if .IsHome }} + {{ $PageContext = .Site }} + {{ end }} + {{ $paginator := .Paginate (where $PageContext.RegularPages "Type" $contentTypeName) }} + + {{ range $paginator.Pages }} + <div class="post on-list"> + <h1 class="post-title"> + <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> + </h1> + <div class="post-meta"> + <span class="post-date"> + {{ .Date.Format "2006-01-02" }} + </span> + {{ with .Params.Author }} + <span class="post-author">:: {{ . }}</span> + {{ end }} + </div> + + {{ if .Params.tags }} + <span class="post-tags"> + {{ range .Params.tags }} + #<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}"> + {{- . -}} + </a> + {{ end }} + </span> + {{ end }} + + + {{ partial "cover.html" . }} + + + <div class="post-content"> + {{ if .Params.showFullContent }} + {{ .Content }} + {{ else if .Description }} + {{ .Description | markdownify }} + {{ else }} + {{ .Summary | markdownify }} + {{ end }} + </div> + + {{ if not .Params.showFullContent }} + <div> + <a class="read-more button" + href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a> + </div> + {{ end }} + </div> + {{ end }} + {{ partial "pagination.html" . }} + </div> +{{ end }} diff --git a/themes/terminal/layouts/_default/list.html b/themes/terminal/layouts/_default/list.html new file mode 100644 index 0000000..02f69b4 --- /dev/null +++ b/themes/terminal/layouts/_default/list.html @@ -0,0 +1,55 @@ +{{ define "main" }} + {{ with .Content }} + <div class="index-content"> + {{ . }} + </div> + {{ end }} + <div class="posts"> + {{ range .Paginator.Pages }} + <div class="post on-list"> + <h1 class="post-title"> + <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a> + </h1> + <div class="post-meta"> + <span class="post-date"> + {{ .Date.Format "2006-01-02" }} + </span> + {{ with .Params.Author }} + <span class="post-author">:: {{ . }}</span> + {{ end }} + </div> + + {{ if .Params.tags }} + <span class="post-tags"> + {{ range .Params.tags }} + #<a href="{{ (urlize (printf "tags/%s/" . )) | absLangURL }}"> + {{- . -}} + </a> + {{ end }} + </span> + {{ end }} + + {{ partial "cover.html" . }} + + + <div class="post-content"> + {{ if .Params.showFullContent }} + {{ .Content }} + {{ else if .Description }} + {{ .Description | markdownify }} + {{ else }} + {{ .Summary | markdownify }} + {{ end }} + </div> + + {{ if not .Params.showFullContent }} + <div> + <a class="read-more button" + href="{{.RelPermalink}}">{{ $.Site.Params.ReadMore }} →</a> + </div> + {{ end }} + </div> + {{ end }} + {{ partial "pagination.html" . }} + </div> +{{ end }} diff --git a/themes/terminal/layouts/_default/rss.xml b/themes/terminal/layouts/_default/rss.xml new file mode 100644 index 0000000..65aa855 --- /dev/null +++ b/themes/terminal/layouts/_default/rss.xml @@ -0,0 +1,40 @@ +{{- $pctx := . -}} +{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}} +{{- $pages := slice -}} +{{- if or $.IsHome $.IsSection -}} +{{- $pages = $pctx.RegularPages -}} +{{- else -}} +{{- $pages = $pctx.Pages -}} +{{- end -}} +{{- $limit := .Site.Config.Services.RSS.Limit -}} +{{- if ge $limit 1 -}} +{{- $pages = $pages | first $limit -}} +{{- end -}} +{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }} +<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> + <channel> + <title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title> + <link>{{ .Permalink }}</link> + <description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description> + <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }} + <language>{{.}}</language>{{end}}{{ with .Site.Author.email }} + <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }} + <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }} + <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }} + <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }} + {{- with .OutputFormats.Get "RSS" -}} + {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }} + {{- end -}} + {{ range $pages }} + <item> + <title>{{ .Title }}</title> + <link>{{ .Permalink }}</link> + <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate> + {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}} + <guid>{{ .Permalink }}</guid> + <description>{{ .Summary | html }}</description> + <content>{{ .Content | html }}</content> + </item> + {{ end }} + </channel> +</rss> diff --git a/themes/terminal/layouts/_default/single.html b/themes/terminal/layouts/_default/single.html new file mode 100644 index 0000000..3d375ad --- /dev/null +++ b/themes/terminal/layouts/_default/single.html @@ -0,0 +1,54 @@ +{{ define "main" }} +<div class="post"> + <h1 class="post-title"> + <a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1> + <div class="post-meta"> + {{ if .Params.Date }} + <span class="post-date"> + {{ .Date.Format "2006-01-02" }} + {{ if $.Site.Params.showLastUpdated }} + [{{or $.Site.Params.updatedDatePrefix "Updated"}}: {{ .Lastmod.Format "2006-01-02" }}] + {{ end }} + </span> + {{ end }} + {{ with .Params.Author }} + <span class="post-author">:: {{ . }}</span> + {{ end }} + {{ if and (.Param "readingTime") (eq (.Param "readingTime") true) }} + <span class="post-reading-time">:: {{ .ReadingTime }} min read ({{ .WordCount }} words)</span> + {{ end }} + </div> + + {{ if .Params.tags }} + <span class="post-tags"> + {{ range .Params.tags }} + #<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a> + {{ end }} + </span> + {{ end }} + {{ partial "cover.html" . }} + + {{ if (.Params.Toc | default .Site.Params.Toc) }} + <div class="table-of-contents"> + <h2> + {{ (.Params.TocTitle | default .Site.Params.TocTitle) | default "Table of Contents" }} + </h2> + {{ .TableOfContents }} + </div> + {{ end }} + + <div class="post-content"> + {{- with .Content -}} + <div> + {{ . | replaceRE "(<h[1-9] id=\"([^\"]+)\".+)(</h[1-9]+>)" `${1}<a href="#${2}" class="hanchor" ariaLabel="Anchor">⌗</a> ${3}` | safeHTML }} + </div> + {{- end -}} + </div> + + {{ if eq .Type $.Site.Params.contentTypeName }} + {{ partial "posts_pagination.html" . }} + {{ end }} + + {{ partial "comments.html" . }} +</div> +{{ end }} diff --git a/themes/terminal/layouts/_default/terms.html b/themes/terminal/layouts/_default/terms.html new file mode 100644 index 0000000..399d665 --- /dev/null +++ b/themes/terminal/layouts/_default/terms.html @@ -0,0 +1,17 @@ +{{ define "main" }} + <div class="terms"> + <h1>{{ .Title }}</h1> + <ul> + {{ $type := .Type }} + {{ range $key, $value := .Data.Terms.Alphabetical }} + {{ $name := .Name }} + {{ $count := .Count }} + {{ with $.Site.GetPage (printf "/%s/%s" $type $name) }} + <li> + <a class="terms-title" href="{{ .Permalink }}">{{ .Name }} ({{ $count }})</a> + </li> + {{ end }} + {{ end }} + </ul> + </div> +{{ end }} diff --git a/themes/terminal/layouts/partials/comments.html b/themes/terminal/layouts/partials/comments.html new file mode 100644 index 0000000..64f5a64 --- /dev/null +++ b/themes/terminal/layouts/partials/comments.html @@ -0,0 +1,8 @@ +<!-- +To add comments section, please create `layouts/partials/comments.html` in your +Hugo directory and insert: + +{{ template "_internal/disqus.html" . }} + +or whatever comment engine you want -> https://gohugo.io/content-management/comments/#readout +--> diff --git a/themes/terminal/layouts/partials/cover.html b/themes/terminal/layouts/partials/cover.html new file mode 100644 index 0000000..ea562ea --- /dev/null +++ b/themes/terminal/layouts/partials/cover.html @@ -0,0 +1,24 @@ +{{- $cover := false -}} +{{- $autoCover := default $.Site.Params.autoCover false }} + +{{- if index .Params "cover" -}} + {{- if .Resources.GetMatch .Params.Cover }} + {{- $cover = (.Resources.GetMatch .Params.Cover).RelPermalink -}} + {{- else -}} + {{- $cover = absURL .Params.Cover -}} + {{- end -}} +{{- else if $.Site.Params.AutoCover -}} + {{- if (not .Params.Cover) -}} + {{- if .Resources.GetMatch "cover.*" -}} + {{- $cover = (.Resources.GetMatch "cover.*").RelPermalink -}} + {{- end -}} + {{- end -}} +{{- end -}} + +{{if $cover -}} + <!-- Cover image found --> + <img src="{{ $cover }}" + class="post-cover" + alt="{{ .Title | plainify | default " " }}" + title="{{ .Params.CoverCredit |plainify|default "Cover Image" }}" /> +{{- end }} diff --git a/themes/terminal/layouts/partials/extended_footer.html b/themes/terminal/layouts/partials/extended_footer.html new file mode 100644 index 0000000..1ef9361 --- /dev/null +++ b/themes/terminal/layouts/partials/extended_footer.html @@ -0,0 +1,4 @@ +<!-- +To add an extended footer section, please create +`layouts/partials/extended_footer.html` in your Hugo directory. +--> diff --git a/themes/terminal/layouts/partials/extended_head.html b/themes/terminal/layouts/partials/extended_head.html new file mode 100644 index 0000000..69baf1f --- /dev/null +++ b/themes/terminal/layouts/partials/extended_head.html @@ -0,0 +1,4 @@ +<!-- +To add an extended head section, please create +`layouts/partials/extended_head.html` in your Hugo directory. +--> diff --git a/themes/terminal/layouts/partials/footer.html b/themes/terminal/layouts/partials/footer.html new file mode 100644 index 0000000..e2588eb --- /dev/null +++ b/themes/terminal/layouts/partials/footer.html @@ -0,0 +1,22 @@ +<footer class="footer"> + <div class="footer__inner"> + {{ if $.Site.Copyright }} + <div class="copyright copyright--user"> + <span>© {{ now.Year }} {{ $.Site.Copyright | safeHTML }}</span> + {{ else }} + <div class="copyright"> + <span>© {{ now.Year }} Powered by <a href="http://gohugo.io">Hugo</a></span> + {{ end }} + </div> + </div> +</footer> + +<script src="{{ "assets/main.js" | absURL }}"></script> +<script src="{{ "assets/prism.js" | absURL }}"></script> + +{{ if $.Site.Params.showLanguageSelector }} + <script src="{{ "assets/languageSelector.js" | absURL }}"></script> +{{ end }} + +<!-- Extended footer section--> +{{ partial "extended_footer.html" . }} diff --git a/themes/terminal/layouts/partials/head.html b/themes/terminal/layouts/partials/head.html new file mode 100644 index 0000000..48f2d28 --- /dev/null +++ b/themes/terminal/layouts/partials/head.html @@ -0,0 +1,76 @@ +<meta http-equiv="content-type" content="text/html; charset=utf-8"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<meta name="description" content="{{ if .IsHome }}{{ $.Site.Params.Subtitle }}{{ else if .Description}}{{ .Description | plainify }}{{ else }}{{ .Summary | plainify }}{{ end }}" /> +<meta name="keywords" content="{{ with .Params.Keywords }}{{ delimit . ", " }}{{ else }}{{ $.Site.Params.Keywords }}{{ end }}" /> +<meta name="robots" content="noodp" /> +<link rel="canonical" href="{{ .Permalink }}" /> + +{{ template "_internal/google_analytics.html" . }} + +<!-- Theme CSS --> +<link rel="stylesheet" href="{{ "assets/style.css" | absURL }}"> +{{ if (isset .Params "color") }} + <link rel="stylesheet" href="{{ (printf "assets/%s.css" .Params.color) | absURL }}"> +{{ else if and (ne $.Site.Params.ThemeColor "orange") (ne $.Site.Params.ThemeColor "color" "") }} + <link rel="stylesheet" href="{{ (printf "assets/%s.css" $.Site.Params.ThemeColor) | absURL }}"> +{{ end }} + +<!-- Custom CSS to override theme properties (/static/style.css) --> +{{ if (fileExists "static/style.css") -}} + <link rel="stylesheet" href="{{ "style.css" | absURL }}"> +{{- end }} + +<!-- Icons --> +<link rel="apple-touch-icon" href="{{ "img/apple-touch-icon-192x192.png" | absURL }}"> +{{ if isset $.Site.Params "favicon" }} + <link rel="shortcut icon" href="{{ $.Site.Params.favicon | absURL }}"> +{{ else }} + <link rel="shortcut icon" href="{{ printf "img/favicon/%s.png" ($.Site.Params.ThemeColor | default "orange") | absURL }}"> +{{ end }} + +<!-- Twitter Card --> +<meta name="twitter:card" content="summary" /> +{{ if (isset $.Site.Params "twitter") }} + {{ if (isset $.Site.Params.Twitter "site") }} + <meta name="twitter:site" content="{{ $.Site.Params.Twitter.site }}" /> + {{ end }} + <meta name="twitter:creator" content="{{ if .IsHome }}{{ $.Site.Params.Twitter.creator }}{{ else if isset .Params "authortwitter" }}{{ .Params.authorTwitter }}{{ else }}{{ .Params.Author }}{{ end }}" /> +{{ end }} + +<!-- OG data --> +<meta property="og:locale" content="{{ $.Site.Language.Lang }}" /> +<meta property="og:type" content="{{ if .IsPage }}article{{ else }}website{{ end }}" /> +<meta property="og:title" content="{{ if .IsHome }}{{ $.Site.Title }}{{ else }}{{ .Title }}{{ end }}"> +<meta property="og:description" content="{{ if .IsHome }}{{ $.Site.Params.Subtitle }}{{ else if .Description}}{{ .Description | plainify }}{{ else }}{{ .Summary | plainify }}{{ end }}" /> +<meta property="og:url" content="{{ .Permalink }}" /> +<meta property="og:site_name" content="{{ $.Site.Title }}" /> +{{ if and (not .IsHome) (isset .Params "cover") }} + <meta property="og:image" content="{{ .Param "cover" | absURL }}"> +{{ else }} + {{ if isset $.Site.Params "favicon" }} + <meta property="og:image" content="{{ $.Site.Params.favicon | absURL }}"> + {{ else }} + <meta property="og:image" content="{{ printf "img/favicon/%s.png" $.Site.Params.ThemeColor | absURL }}"> + {{ end }} +{{ end }} +<meta property="og:image:width" content="2048"> +<meta property="og:image:height" content="1024"> +{{ range .Params.categories }} + <meta property="article:section" content="{{ . }}" /> +{{ end }} +{{ if isset .Params "date" }} + <meta property="article:published_time" content="{{ time .Date }}" /> +{{ end }} + +<!-- RSS --> +{{ with .OutputFormats.Get "RSS" }} + <link href="{{ .RelPermalink }}" rel="alternate" type="application/rss+xml" title="{{ $.Site.Title }}" /> +{{ end }} + +<!-- JSON Feed --> +{{ with .OutputFormats.Get "json" }} + <link href="{{ .RelPermalink }}" rel="alternate" type="application/json" title="{{ $.Site.Title }}" /> +{{ end }} + +<!-- Extended head section--> +{{ partial "extended_head.html" . }} diff --git a/themes/terminal/layouts/partials/header.html b/themes/terminal/layouts/partials/header.html new file mode 100644 index 0000000..23214f8 --- /dev/null +++ b/themes/terminal/layouts/partials/header.html @@ -0,0 +1,13 @@ +<header class="header"> + <div class="header__inner"> + <div class="header__logo"> + {{ partial "logo.html" . }} + </div> + {{ if len $.Site.Menus }} + <div class="menu-trigger">menu</div> + {{ end }} + </div> + {{ if len $.Site.Menus }} + {{ partial "menu.html" . }} + {{ end }} +</header> diff --git a/themes/terminal/layouts/partials/logo.html b/themes/terminal/layouts/partials/logo.html new file mode 100644 index 0000000..8a1bf1f --- /dev/null +++ b/themes/terminal/layouts/partials/logo.html @@ -0,0 +1,5 @@ +<a href="{{ if $.Site.Params.Logo.LogoHomeLink }}{{ $.Site.Params.Logo.LogoHomeLink }}{{else}}{{ $.Site.BaseURL }}{{ end }}"> + <div class="logo"> + {{ with $.Site.Params.Logo.logoText }}{{ . }}{{ else }}Terminal{{ end }} + </div> +</a> diff --git a/themes/terminal/layouts/partials/menu.html b/themes/terminal/layouts/partials/menu.html new file mode 100644 index 0000000..17d39c8 --- /dev/null +++ b/themes/terminal/layouts/partials/menu.html @@ -0,0 +1,60 @@ +<nav class="menu"> + <ul class="menu__inner menu__inner--desktop"> + {{ if or $.Site.Params.showMenuItems ( eq .Site.Params.showMenuItems 0 ) }} + {{ range first $.Site.Params.showMenuItems $.Site.Menus.main }} + {{ if not .HasChildren }} + <li><a href="{{ .URL }}">{{ .Name }}</a></li> + {{ end }} + {{ end }} + {{ if gt (len $.Site.Menus.main) $.Site.Params.showMenuItems }} + <ul class="menu__sub-inner"> + <li class="menu__sub-inner-more-trigger">{{ $.Site.Params.MenuMore }} ▾</li> + + <ul class="menu__sub-inner-more hidden"> + {{ range last (sub (len $.Site.Menus.main) $.Site.Params.showMenuItems) $.Site.Menus.main }} + {{ if not .HasChildren }} + <li><a href="{{ .URL }}">{{ .Name }}</a></li> + {{ end }} + {{ end }} + </ul> + </ul> + {{ end }} + {{ else }} + {{ range $.Site.Menus.main }} + {{ if not .HasChildren }} + <li><a href="{{ .URL }}">{{ .Name }}</a></li> + {{ end }} + {{ end }} + {{ end }} + + {{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }} + <div class="spacer"></div> + <ul class="language-selector"> + <ul class="language-selector-current"> + <li>{{ .Language.LanguageName }} ▾</li> + </ul> + <ul class="language-selector__more hidden"> + {{ range $.Site.Home.AllTranslations }} + <li><a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a></li> + {{ end }} + </ul> + </ul> + {{ end }} + </ul> + + <ul class="menu__inner menu__inner--mobile"> + {{ range $.Site.Menus.main }} + {{ if not .HasChildren }} + <li><a href="{{ .URL }}">{{ .Name }}</a></li> + {{ end }} + {{ end }} + {{ if and $.Site.Params.showLanguageSelector (len $.Site.Home.AllTranslations) }} + <hr /> + {{ range $.Site.Home.AllTranslations }} + <li> + <a href="{{ .Permalink }}">{{ .Language.LanguageName }}</a> + </li> + {{ end }} + {{ end }} + </ul> +</nav> diff --git a/themes/terminal/layouts/partials/pagination.html b/themes/terminal/layouts/partials/pagination.html new file mode 100644 index 0000000..777a6b4 --- /dev/null +++ b/themes/terminal/layouts/partials/pagination.html @@ -0,0 +1,20 @@ +<div class="pagination"> + <div class="pagination__buttons"> + {{ if .Paginator.HasPrev }} + <span class="button previous"> + <a href="{{ .Paginator.Prev.URL }}"> + <span class="button__icon">←</span> + <span class="button__text">{{ $.Site.Params.newerPosts | default "Newer posts" }}</span> + </a> + </span> + {{ end }} + {{ if .Paginator.HasNext }} + <span class="button next"> + <a href="{{ .Paginator.Next.URL }}"> + <span class="button__text">{{ $.Site.Params.olderPosts | default "Older posts" }}</span> + <span class="button__icon">→</span> + </a> + </span> + {{ end }} + </div> +</div> diff --git a/themes/terminal/layouts/partials/posts_pagination.html b/themes/terminal/layouts/partials/posts_pagination.html new file mode 100644 index 0000000..04951d5 --- /dev/null +++ b/themes/terminal/layouts/partials/posts_pagination.html @@ -0,0 +1,26 @@ +{{ if or .NextInSection .PrevInSection }} +<div class="pagination"> + <div class="pagination__title"> + <span class="pagination__title-h">{{ $.Site.Params.ReadOtherPosts }}</span> + <hr /> + </div> + <div class="pagination__buttons"> + {{ if .NextInSection }} + <span class="button previous"> + <a href="{{ .NextInSection.Permalink }}"> + <span class="button__icon">←</span> + <span class="button__text">{{ .NextInSection.Title }}</span> + </a> + </span> + {{ end }} + {{ if .PrevInSection }} + <span class="button next"> + <a href="{{ .PrevInSection.Permalink }}"> + <span class="button__text">{{ .PrevInSection.Title }}</span> + <span class="button__icon">→</span> + </a> + </span> + {{ end }} + </div> +</div> +{{ end }}
\ No newline at end of file diff --git a/themes/terminal/layouts/shortcodes/code.html b/themes/terminal/layouts/shortcodes/code.html new file mode 100644 index 0000000..8bab825 --- /dev/null +++ b/themes/terminal/layouts/shortcodes/code.html @@ -0,0 +1,15 @@ +{{ $id := delimit (shuffle (seq 1 9)) "" }} + +{{ if .Get "language" }} + <div class="collapsable-code"> + <input id="{{ .Get "id" | default $id }}" type="checkbox" {{ if ( eq ( .Get "isCollapsed" ) "true" ) -}} checked {{- end }} /> + <label for="{{ .Get "id" | default $id }}"> + <span class="collapsable-code__language">{{ .Get "language" }}</span> + {{ if .Get "title" }}<span class="collapsable-code__title">{{ .Get "title" | markdownify }}</span>{{ end }} + <span class="collapsable-code__toggle" data-label-expand="{{ .Get "expand" | default "△" }}" data-label-collapse="{{ .Get "collapse" | default "▽" }}"></span> + </label> + <pre {{ if .Get "language" }}class="language-{{ .Get "language" }}" {{ end }}><code>{{ .Inner | string }}</code></pre> + </div> +{{ else }} + {{ errorf "If you want to use the \"collapsable code\" shortcode, you need to pass a mandatory \"language\" param. The issue occured in %q (%q)" .Page.File .Page.Permalink }} +{{ end }} diff --git a/themes/terminal/layouts/shortcodes/figure.html b/themes/terminal/layouts/shortcodes/figure.html new file mode 100644 index 0000000..6642c82 --- /dev/null +++ b/themes/terminal/layouts/shortcodes/figure.html @@ -0,0 +1,8 @@ +{{ if .Get "src" }} + <figure class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" > + <img src="{{ .Get "src" | safeURL }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} /> + {{ if .Get "caption" }} + <figcaption class="{{ with .Get "captionPosition"}}{{ . }}{{ else -}} center {{- end }}" {{ with .Get "captionStyle" }} style="{{ . | safeCSS }}" {{ end }}>{{ .Get "caption" | safeHTML }}</figcaption> + {{ end }} + </figure> +{{ end }} diff --git a/themes/terminal/layouts/shortcodes/image.html b/themes/terminal/layouts/shortcodes/image.html new file mode 100644 index 0000000..6b2a2c0 --- /dev/null +++ b/themes/terminal/layouts/shortcodes/image.html @@ -0,0 +1,3 @@ +{{ if .Get "src" }} + <img src="{{ .Get "src" | safeURL }}" {{ with .Get "alt" }} alt="{{ . | plainify }}" {{ end }} class="{{ with .Get "position"}}{{ . }}{{ else -}} left {{- end }}" {{ with .Get "style" }} style="{{ . | safeCSS }}" {{ end }} /> +{{ end }} diff --git a/themes/terminal/layouts/shortcodes/prismjs.html b/themes/terminal/layouts/shortcodes/prismjs.html new file mode 100644 index 0000000..e4acffe --- /dev/null +++ b/themes/terminal/layouts/shortcodes/prismjs.html @@ -0,0 +1,25 @@ +{{ $inner := replaceRE "^\r?\n" "" .Inner | string }} +{{ if len .Params | eq 0 }} + <pre><code>{{ $inner }}</code></pre> +{{ else }} + {{ if .IsNamedParams }} + <pre class=" + {{- if .Get "lang" }}language-{{ .Get "lang" }}{{ end }} + {{- if .Get "line-numbers" }} line-numbers{{ end }} + {{- if .Get "command-line" }} command-line{{ end }}" + {{- /* line highlight plugin */ -}} + {{- if .Get "line" }} data-line="{{ .Get "line" }}"{{ end }} + {{- /* line number plugin */ -}} + {{- if .Get "start" }} data-start="{{ .Get "start" }}"{{ end }} + {{- /* command-line plugin */ -}} + {{- if .Get "user" }} data-user="{{ .Get "user" }}"{{ end }} + {{- if .Get "host" }} data-host="{{ .Get "host" }}"{{ end }} + {{- if .Get "prompt" }} data-prompt="{{ .Get "prompt" }}"{{ end }} + {{- if .Get "output" }} data-output="{{ .Get "output" }}"{{ end }} + ><code {{ if .Get "lang" }}class="language-{{ .Get "lang" }}"{{ end }} + >{{ $inner }}</code></pre> + {{ else }} + <pre class="language-{{ .Get 0 }}"> + <code class="language-{{ .Get 0 }}">{{ $inner }}</code></pre> + {{ end }} +{{ end }} |