diff options
author | somrat <monnaf37@gmail.com> | 2019-07-04 12:53:43 +0300 |
---|---|---|
committer | somrat <monnaf37@gmail.com> | 2019-07-04 12:53:43 +0300 |
commit | d7cc8df34b58a7fd97c032178d8ffda537a6e805 (patch) | |
tree | 65bc518ad0e1fe03a746042f1ff7c25d48765ffd /layouts |
initialize template
Diffstat (limited to 'layouts')
83 files changed, 3398 insertions, 0 deletions
diff --git a/layouts/404.html b/layouts/404.html new file mode 100644 index 0000000..404df1b --- /dev/null +++ b/layouts/404.html @@ -0,0 +1,31 @@ +{{- define "main" -}} + +<div class="universal-wrapper pt-3"> + + <h1>{{ i18n "page_not_found" }}</h1> + + {{/* Show search box if Academic's search engine is enabled. */}} + {{ if eq site.Params.search.engine 1 }} + <form class="d-flex align-items-center mb-3"> + <input name="q" type="search" class="form-control" id="search-query" placeholder="{{ i18n "search_placeholder" }}" autocomplete="off"> + </form> + {{ end }} + + {{/* Suggest recently published pages to the user. */}} + + <p>{{ i18n "404_recommendations" }}</p> + + {{ $query := site.RegularPages }} + {{ $count := len $query }} + {{ if gt $count 0 }} + <h2>{{ i18n "user_profile_latest" }}</h2> + <ul> + {{ range first 10 $query }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} + </ul> + {{ end }} + +</div> + +{{- end -}} diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html new file mode 100644 index 0000000..c8d0677 --- /dev/null +++ b/layouts/_default/baseof.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<html lang="{{ site.LanguageCode | default "en-us" }}"> + +{{ partial "site_head.html" . }} + +<body id="top" data-spy="scroll" data-target="{{ if or .IsHome (eq .Type "widget_page") }}#navbar-main{{else}}#TableOfContents{{end}}" data-offset="71" {{ if not (.Scratch.Get "light") }}class="dark"{{end}}> + + {{ partial "search" . }} + + {{ partial "navbar.html" . }} + + {{ block "main" . }}{{ end }} + + {{ partial "site_js.html" . }} + + {{ if ne .Type "docs" }} + <div class="container"> + {{ partial "site_footer.html" . }} + </div> + {{ end }} + + {{ partial "citation.html" . }} + +</body> +</html> diff --git a/layouts/_default/list.html b/layouts/_default/list.html new file mode 100644 index 0000000..4a86e6a --- /dev/null +++ b/layouts/_default/list.html @@ -0,0 +1,29 @@ +{{- define "main" -}} + +{{ partial "page_header.html" . }} + +<div class="universal-wrapper"> + {{ with .Content }} + <div class="article-style" itemprop="articleBody">{{ . }}</div> + {{ end }} + + {{ $paginator := .Paginate .Data.Pages }} + {{ range $paginator.Pages }} + <div> + <h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2> + <div class="article-style"> + {{ if .Params.summary }} + {{ .Params.summary | plainify | emojify }} + {{ else if .Params.abstract }} + {{ .Params.abstract | plainify | emojify | truncate 250 }} + {{ else if .Summary }} + {{ .Summary | plainify | emojify }} + {{ end }} + </div> + </div> + {{ end }} + + {{ partial "pagination" . }} +</div> + +{{- end -}} diff --git a/layouts/_default/rss.xml b/layouts/_default/rss.xml new file mode 100644 index 0000000..8b5c420 --- /dev/null +++ b/layouts/_default/rss.xml @@ -0,0 +1,33 @@ +{{/* Generate RSS with full page content rather than just summary. */}} +{{- $pages := .Data.Pages -}} +{{- $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>Source Themes Academic (https://sourcethemes.com/academic/)</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>{{ .Content | html }}</description> + </item> + {{ end }} + </channel> +</rss> diff --git a/layouts/_default/single.html b/layouts/_default/single.html new file mode 100644 index 0000000..fd9a665 --- /dev/null +++ b/layouts/_default/single.html @@ -0,0 +1,42 @@ +{{- define "main" -}} + +<article class="article py-5" itemscope itemtype="http://schema.org/Article"> + + {{ partial "page_header.html" . }} + + <div class="article-container"> + + <div class="article-style" itemprop="articleBody"> + {{ .Content }} + </div> + + {{ partial "tags.html" . }} + + {{ if ne .Type "page" }} + {{ partial "page_author.html" . }} + {{ $related := site.RegularPages.Related . | first 5 }} + {{ with $related }} + <div class="article-widget"> + <div class="hr-light"></div> + <h3>{{ i18n "related" }}</h3> + <ul> + {{ range . }} + <li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li> + {{ end }} + </ul> + </div> + {{ end }} + {{ end }} + + {{ if site.Params.section_pager }} + <div class="article-widget"> + {{ partial "section_pager.html" . }} + </div> + {{ end }} + + {{ partial "comments.html" . }} + + </div> +</article> + +{{- end -}} diff --git a/layouts/authors/list.html b/layouts/authors/list.html new file mode 100644 index 0000000..2176e09 --- /dev/null +++ b/layouts/authors/list.html @@ -0,0 +1,40 @@ +{{/* Author profile page. */}} + +{{- define "main" -}} + +{{/* If an account has not been created for this user, just display their name as the title. */}} +{{ if not .File }} +<div class="universal-wrapper pt-3"> + <h1 itemprop="name">{{ .Title }}</h1> +</div> +{{ end }} + +<section id="profile-page" class="pt-5"> + <div class="container"> + {{/* Show the About widget if an account exists for this user. */}} + {{ if .File }} + {{ $widget := "widgets/about.html" }} + {{ $username := (path.Base (path.Split .Path).Dir) }}{{/* Alternatively, use `index .Params.authors 0` */}} + {{ $params := dict "root" $ "page" . "author" $username }} + {{ partial $widget $params }} + {{end}} + + {{ $query := where .Pages ".IsNode" false }} + {{ $count := len $query }} + {{ if $count }} + <div class="article-widget"> + <div class="hr-light"></div> + <h3>{{ i18n "user_profile_latest" | default "Latest" }}</h3> + <ul> + {{ range $query }} + <li> + <a href="{{ .RelPermalink }}">{{ .Title }}</a> + </li> + {{ end }} + </ul> + </div> + </div> + {{ end }} +</section> + +{{- end -}} diff --git a/layouts/authors/terms.html b/layouts/authors/terms.html new file mode 100644 index 0000000..f896944 --- /dev/null +++ b/layouts/authors/terms.html @@ -0,0 +1,23 @@ +{{/* List of all authors. */}} + +{{- define "main" -}} + +{{ partial "page_header.html" . }} + +<div class="universal-wrapper"> + {{ with .Content }} + <div class="article-style" itemprop="articleBody">{{ . }}</div> + {{ end }} + + <ul> + {{ $paginator := .Paginate .Data.Pages }} + {{ range $k, $v := $paginator.Pages }} + {{ $name := $v.Params.name | default ($v.Title|plainify) }} + <li><a href="{{$v.Permalink}}">{{$name}}</a></li> + {{ end }} + </ul> + + {{ partial "pagination" . }} +</div> + +{{- end -}} diff --git a/layouts/docs/list.html b/layouts/docs/list.html new file mode 100644 index 0000000..34d123d --- /dev/null +++ b/layouts/docs/list.html @@ -0,0 +1,3 @@ +{{- define "main" -}} +{{ partial "docs_layout.html" . }} +{{- end -}} diff --git a/layouts/docs/single.html b/layouts/docs/single.html new file mode 100644 index 0000000..34d123d --- /dev/null +++ b/layouts/docs/single.html @@ -0,0 +1,3 @@ +{{- define "main" -}} +{{ partial "docs_layout.html" . }} +{{- end -}} diff --git a/layouts/index.html b/layouts/index.html new file mode 100644 index 0000000..d79d8ce --- /dev/null +++ b/layouts/index.html @@ -0,0 +1,9 @@ +{{- define "main" -}} + +{{ if not (isset site.Params "color_theme") }} + {{ errorf "Please complete the installation of Academic by following the steps at https://sourcethemes.com/academic/docs/install/" }} +{{ end }} + +{{ partial "widget_page.html" . }} + +{{- end -}} diff --git a/layouts/index.json b/layouts/index.json new file mode 100644 index 0000000..4f25eb3 --- /dev/null +++ b/layouts/index.json @@ -0,0 +1,62 @@ +{{- /* Generate the search index. */ -}} +{{- $index := slice -}} +{{- $pages := site.RegularPages -}} +{{- /* Add the index page of docs separately since it's not in RegularPages above. */ -}} +{{- $pages := $pages | union (where (where site.Pages "Kind" "section") "Type" "docs") -}} +{{- /* Add author pages to index so their bios can be searched. Hide empty `/authors/` node. */ -}} +{{- $pages := $pages | union (where (where site.Pages "Section" "authors") "Params.name" "!=" nil) -}} + +{{- range $pages -}} + {{- /* Do not index drafts or private pages. */ -}} + {{- if and (not .Draft) (not .Params.private) -}} + + {{- /* Generate page description. */ -}} + {{- $desc := "" -}} + {{- if .Params.summary -}} + {{- $desc = .Params.summary -}} + {{- else if .Params.abstract -}} + {{- $desc = .Params.abstract -}} + {{- else -}} + {{- $desc = .Summary -}} + {{- end -}} + + {{- $authors := .Params.authors -}} + {{- $title := .Title}} + {{- $rel_permalink := .RelPermalink -}} + {{- $permalink := .Permalink -}} + + {{/* Correct the title and URL for author profile pages. */}} + {{- if eq .Section "authors" -}} + {{- $title = .Params.name -}} + {{- $username := path.Base (path.Split .Path).Dir -}} + {{- with site.GetPage (printf "/authors/%s" $username) -}} + {{- $permalink = .Permalink -}} + {{- $rel_permalink = .RelPermalink -}} + {{- end -}} + {{- else -}} + {{/* Include a user's display name rather than username where possible. */}} + {{- if .Params.authors -}} + {{- $authorLen := len .Params.authors -}} + {{- if gt $authorLen 0 -}} + {{- $authors = slice -}} + {{- range $k, $v := .Params.authors -}} + {{- $person_page_path := (printf "/authors/%s" (urlize $v)) -}} + {{- $person_page := site.GetPage $person_page_path -}} + {{- if and $person_page $person_page.File -}} + {{- $person := $person_page.Params -}} + {{- $authors = $authors | append $person.name -}} + {{- else -}} + {{- $authors = $authors | append ($v | plainify) -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + {{- end -}} + + {{- /* Add page to index. */ -}} + {{- $index = $index | append (dict "objectID" .File.UniqueID "date" .Date.UTC.Unix "publishdate" .PublishDate "lastmod" .Lastmod.UTC.Unix "expirydate" .ExpiryDate.UTC.Unix "lang" .Lang "permalink" $permalink "relpermalink" $rel_permalink "title" $title "summary" (plainify $desc) "content" .Plain "authors" $authors "kind" .Kind "type" .Type "section" .Section "tags" .Params.Tags "categories" .Params.Categories) -}} + + {{- end -}} +{{- end -}} + +{{- $index | jsonify -}}
\ No newline at end of file diff --git a/layouts/partials/citation.html b/layouts/partials/citation.html new file mode 100644 index 0000000..01620ae --- /dev/null +++ b/layouts/partials/citation.html @@ -0,0 +1,25 @@ +<!-- Citation modal --> +<div id="modal" class="modal fade" role="dialog"> + <div class="modal-dialog"> + <div class="modal-content"> + <div class="modal-header"> + <h5 class="modal-title">{{ i18n "btn_cite" }}</h5> + <button type="button" class="close" data-dismiss="modal" aria-label="Close"> + <span aria-hidden="true">×</span> + </button> + </div> + <div class="modal-body"> + <pre><code class="tex hljs"></code></pre> + </div> + <div class="modal-footer"> + <a class="btn btn-outline-primary my-1 js-copy-cite" href="#" target="_blank"> + <i class="fas fa-copy"></i> {{ i18n "btn_copy" }} + </a> + <a class="btn btn-outline-primary my-1 js-download-cite" href="#" target="_blank"> + <i class="fas fa-download"></i> {{ i18n "btn_download" }} + </a> + <div id="modal-error"></div> + </div> + </div> + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/comments.html b/layouts/partials/comments.html new file mode 100644 index 0000000..977ec84 --- /dev/null +++ b/layouts/partials/comments.html @@ -0,0 +1,5 @@ +{{ if and site.DisqusShortname (not (or site.Params.disable_comments .Params.disable_comments)) }} +<section id="comments"> + {{ template "_internal/disqus.html" . }} +</section> +{{ end }} diff --git a/layouts/partials/cookie_consent.html b/layouts/partials/cookie_consent.html new file mode 100644 index 0000000..9e7536a --- /dev/null +++ b/layouts/partials/cookie_consent.html @@ -0,0 +1,27 @@ +{{ if site.Params.privacy_pack }} +{{ $scr := .Scratch }} +<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css"> +<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script> +<script> + window.addEventListener("load", function(){ + window.cookieconsent.initialise({ + "palette": { + "popup": { + "background": "{{ $scr.Get "primary" }}", + "text": "{{ $scr.Get "background" }}" + }, + "button": { + "background": "{{ $scr.Get "background" }}", + "text": "{{ $scr.Get "primary" }}" + } + }, + "theme": "classic", + "content": { + "message": {{ i18n "cookie_message" | default "This website uses cookies to ensure you get the best experience on our website." }}, + "dismiss": {{ i18n "cookie_dismiss" | default "Got it!" }}, + "link": {{ i18n "cookie_learn" | default "Learn more" }}, + "href": {{ with site.GetPage "privacy.md" }}{{ printf "%s" .RelPermalink }}{{ else }}"https://cookies.insites.com"{{ end }} + } + })}); +</script> +{{ end }} diff --git a/layouts/partials/custom_head.html b/layouts/partials/custom_head.html new file mode 100644 index 0000000..cb4802f --- /dev/null +++ b/layouts/partials/custom_head.html @@ -0,0 +1,4 @@ +{{/* Do not directly modify this file! */}} +{{/* Instead, create a `layout/partials/custom_head.html` file in your site and add your code to it. */}} + +{{/* This partial is included in `themes/academic/layout/partials/site_head.html`. */}} diff --git a/layouts/partials/custom_js.html b/layouts/partials/custom_js.html new file mode 100644 index 0000000..0b66fff --- /dev/null +++ b/layouts/partials/custom_js.html @@ -0,0 +1,4 @@ +{{/* Do not directly modify this file! */}} +{{/* Instead, create a `layout/partials/custom_js.html` file in your site and add your code to it. */}} + +{{/* This partial is included in `themes/academic/layout/partials/site_js.html`. */}} diff --git a/layouts/partials/docs_layout.html b/layouts/partials/docs_layout.html new file mode 100644 index 0000000..c8e04ea --- /dev/null +++ b/layouts/partials/docs_layout.html @@ -0,0 +1,51 @@ +{{ $current_page := . }} + +<div class="container-fluid docs"> + <div class="row flex-xl-nowrap"> + <div class="col-12 col-md-3 col-xl-2 docs-sidebar"> + {{ partial "docs_sidebar.html" . }} + </div> + + {{ if .Params.toc }} + <div class="d-none d-xl-block col-xl-2 docs-toc"> + <ul class="nav toc-top"> + <li><a href="#" id="back_to_top" class="docs-toc-title">{{ i18n "on_this_page" }}</a></li> + </ul> + + {{ .TableOfContents }} + + {{ partial "docs_toc_foot.html" . }} + </div> + {{ end }} + + <main class="col-12 col-md-9 col-xl-8 py-md-3 pl-md-5 docs-content" role="main"> + + <article class="article" itemscope itemtype="http://schema.org/Article"> + + <div class="docs-article-container"> + <h1 itemprop="name">{{ .Title }}</h1> + + <div class="article-style" itemprop="articleBody"> + {{ .Content }} + </div> + + {{ partial "tags.html" . }} + + {{ if site.Params.docs_section_pager }} + <div class="article-widget"> + {{ partial "section_pager.html" . }} + </div> + {{ end }} + </div> + + <div class="body-footer"> + {{ i18n "last_updated" }} {{ $.Lastmod.Format site.Params.date_format }} + </div> + + </article> + + {{ partial "site_footer.html" . }} + + </main> + </div> +</div> diff --git a/layouts/partials/docs_sidebar.html b/layouts/partials/docs_sidebar.html new file mode 100644 index 0000000..08e5ab1 --- /dev/null +++ b/layouts/partials/docs_sidebar.html @@ -0,0 +1,38 @@ +{{ $current_page := . }} + +{{/* Dynamically load menu for this docs page. */}} +{{ $menu_name := path.Base (path.Split .CurrentSection.File).Dir }} +{{ if not (index site.Menus $menu_name) }} + {{ errorf "Please define menu items named `menu: %s:` in your %s front matter or define `[[menu.%s]]` in `config/default/menus.toml`. See https://sourcethemes.com/academic/docs/managing-content/#menus" $menu_name .Path $menu_name }} +{{ end }} + +<form class="docs-search d-flex align-items-center"> + <button class="btn docs-toggle d-md-none p-0 mr-3" type="button" data-toggle="collapse" data-target="#docs-nav" aria-controls="docs-nav" aria-expanded="false" aria-label="Toggle section navigation"> + <span><i class="fas fa-bars"></i></span> + </button> + + {{ if eq site.Params.search.engine 1 }} + <input name="q" type="search" class="form-control" id="search-query" placeholder="{{ i18n "search_placeholder" }}" autocomplete="off"> + {{ end }} +</form> + +<nav class="collapse docs-links" id="docs-nav"> + {{ with (index site.Menus $menu_name) }} + {{ range (index site.Menus $menu_name).ByWeight }} + <div class="docs-toc-item{{ if $current_page.IsMenuCurrent $menu_name . }} active{{ end }}"> + <a class="docs-toc-link" {{ if .URL }}href="{{ .URL }}"{{else if .HasChildren }}href="{{ (index .Children 0).URL }}"{{end}}>{{ .Name }}</a> + + {{- if .HasChildren }} + <ul class="nav docs-sidenav"> + {{ range .Children }} + <li {{ if $current_page.IsMenuCurrent $menu_name . }}class="active"{{ end }}> + <a href="{{ .URL }}">{{ .Name }}</a> + </li> + {{ end }} + </ul> + {{ end }} + + </div> + {{ end }} + {{ end }} +</nav> diff --git a/layouts/partials/docs_toc_foot.html b/layouts/partials/docs_toc_foot.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/partials/docs_toc_foot.html diff --git a/layouts/partials/functions/get_pub_types.html b/layouts/partials/functions/get_pub_types.html new file mode 100644 index 0000000..7a8f1fd --- /dev/null +++ b/layouts/partials/functions/get_pub_types.html @@ -0,0 +1,6 @@ +{{/* Get Publication Types */}} +{{ $pub_types := slice }} +{{ range site.Data.publication_types.types }} + {{ $pub_types = $pub_types | append (i18n . | default "Uncategorized") }} +{{ end }} +{{ return $pub_types }} diff --git a/layouts/partials/functions/parse_theme.html b/layouts/partials/functions/parse_theme.html new file mode 100644 index 0000000..bee1140 --- /dev/null +++ b/layouts/partials/functions/parse_theme.html @@ -0,0 +1,53 @@ +{{- $scr := .Scratch -}} + +{{/* Attempt to load font style specified by user. */}} +{{- $font_index := site.Params.font | default "default" -}} +{{ if (index site.Data.fonts $font_index) }} + {{- $font := index site.Data.fonts $font_index -}} + {{- $scr.Set "google_fonts" $font.google_fonts -}} + {{- $scr.Set "body_font" $font.body_font -}} + {{- $scr.Set "heading_font" $font.heading_font -}} + {{- $scr.Set "nav_font" $font.nav_font -}} + {{- $scr.Set "mono_font" $font.mono_font -}} + {{- $scr.Set "font_size" $font.font_size -}} + {{- $scr.Set "font_size_small" $font.font_size_small -}} +{{ else }} + {{ errorf "The `%s` font theme was not found! Check that the `font` option in `config/_default/params.toml` matches the name of an installed font theme." $font_index }} +{{ end }} + +{{/* Attempt to load color theme specified by user. */}} +{{- $theme_index := site.Params.color_theme | default "default" -}} +{{ if (index site.Data.themes $theme_index) }} + {{ $theme := index site.Data.themes $theme_index }} + + {{- $scr.Set "light" ($theme.light | default true) -}} + + {{ if $theme.light }} + {{- $scr.Set "background" ($theme.background | default "#fff") -}} + {{- $scr.Set "dark_background" "rgb(40, 42, 54)" -}} + {{- $scr.Set "home_section_odd" $theme.home_section_odd -}} + {{- $scr.Set "home_section_even" $theme.home_section_even -}} + {{- $scr.Set "dark_home_section_odd" "hsla(231, 15%, 18%, 1)" -}} + {{- $scr.Set "dark_home_section_even" "hsla(231, 15%, 16%, 1)" -}} + {{ else }} + {{- $scr.Set "background" ($theme.background | default "#fff") -}} + {{- $scr.Set "dark_background" ($theme.background | default "rgb(40, 42, 54)") -}} + {{- $scr.Set "home_section_odd" "rgb(255, 255, 255)" -}} + {{- $scr.Set "home_section_even" "rgb(247, 247, 247)" -}} + {{- $scr.Set "dark_home_section_odd" $theme.home_section_odd -}} + {{- $scr.Set "dark_home_section_even" $theme.home_section_even -}} + {{ end }} + + {{- $scr.Set "link" ($theme.link | default $theme.primary) -}} + {{- $scr.Set "link_hover" ($theme.link_hover | default $theme.primary) -}} + + {{- $scr.Set "primary" $theme.primary -}} + + {{- $scr.Set "menu_primary" $theme.menu_primary -}} + {{- $scr.Set "menu_text" $theme.menu_text -}} + {{- $scr.Set "menu_text_active" $theme.menu_text_active -}} + {{- $scr.Set "menu_title" $theme.menu_title -}} + +{{ else }} + {{ errorf "The `%s` color theme was not found! Check that the `color_theme` option in `config/_default/params.toml` matches the name of an installed color theme." $theme_index }} +{{ end }} diff --git a/layouts/partials/li_card.html b/layouts/partials/li_card.html new file mode 100644 index 0000000..59455b9 --- /dev/null +++ b/layouts/partials/li_card.html @@ -0,0 +1,81 @@ +{{ $item := . }} + +{{ $microdata_type := "CreativeWork" }} +{{ $show_buttons := false }} + +{{/* Dynamic view adjusts to content type. */}} +{{ if eq $item.Type "post" }} +{{ $microdata_type = "BlogPosting" }} +{{ else if eq $item.Type "talk" }} +{{ $microdata_type = "Event" }} +{{ $show_buttons = true }} +{{ else if eq $item.Type "publication" }} +{{ $microdata_type = "ScholarlyArticle" }} +{{ $show_buttons = true }} +{{ end }} + +{{/* Get summary. */}} +{{ $summary := "" }} +{{ if $item.Params.summary }} +{{ $summary = $item.Params.summary | markdownify | emojify }} +{{ else if .Params.abstract }} +{{ $summary = .Params.abstract | markdownify | emojify }} +{{ else if $item.Truncated }} +{{ $summary = $item.Summary }} +{{ else }} +{{ $summary = $item.Content }} +{{ end }} + +<div class="card-simple" itemscope itemtype="http://schema.org/{{$microdata_type}}"> + {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }} + {{ $anchor := $item.Params.image.focal_point | default "Smart" }} + {{ with $resource }} + {{ $image := .Fill (printf "918x517 q90 %s" $anchor) }} + <a href="{{ $item.RelPermalink }}"> + <img src="{{ $image.RelPermalink }}" class="article-banner" itemprop="image" alt=""> + </a> + {{end}} + + <div class="card-body"> + <h3 class="article-title mb-1 mt-0" itemprop="name"> + <a href="{{ $item.RelPermalink }}" itemprop="url">{{ $item.Title }}</a> + </h3> + {{ if eq $item.Type "talk" }} + <div class="article-metadata"> + {{ if $item.Params.authors }} + <div itemprop="author"> + {{ partial "page_metadata_authors" $item }} + </div> + {{ end }} + <span itemprop="startDate"> + {{ $date := $item.Date }} + {{ (time $date).Format site.Params.date_format }} + {{ if not $item.Params.all_day }} + {{ (time $date).Format (site.Params.time_format | default "3:04 PM") }} + {{ with $item.Params.date_end }} + — {{ (time .).Format (site.Params.time_format | default "3:04 PM") }} + {{ end }} + {{ end }} + </span> + {{ with $item.Params.location }} + <span class="middot-divider"></span> + <span itemprop="location">{{ . }}</span> + {{ end }} + </div> + {{ else }} + {{ partial "page_metadata" (dict "page" $item "is_list" 1) }} + {{ end }} + {{ with $summary }} + <div class="article-style" itemprop="articleBody"> + {{ . }} + </div> + {{ end }} + + + {{ if $show_buttons }} + <div class="btn-links"> + {{ partial "page_links" (dict "page" $item "is_list" 1) }} + </div> + {{ end }} + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/li_citation.html b/layouts/partials/li_citation.html new file mode 100644 index 0000000..4a34adf --- /dev/null +++ b/layouts/partials/li_citation.html @@ -0,0 +1,35 @@ +<div class="pub-list-item" style="margin-bottom: 1rem" itemscope itemtype="http://schema.org/CreativeWork"> + <i class="far fa-file-alt pub-icon" aria-hidden="true"></i> + + {{/* APA Style */}} + {{ if eq (site.Params.publications.citation_style | default "apa") "apa" }} + + <span itemprop="author" class="article-metadata li-cite-author"> + {{ partial "page_metadata_authors" . }} + </span> + ({{- .Date.Format "2006" -}}). + <a href="{{ .RelPermalink }}" itemprop="name">{{ .Title }}</a>. + {{ if .Params.publication_short }} + {{- .Params.publication_short | markdownify -}}. + {{ else if .Params.publication }} + {{- .Params.publication | markdownify -}}. + {{ end }} + <p>{{ partial "page_links" (dict "page" . "is_list" 1) }}</p> + + {{/* MLA Style */}} + {{ else }} + + <span itemprop="author" class="article-metadata li-cite-author"> + {{ partial "page_metadata_authors" . }} + </span>. + <a href="{{ .RelPermalink }}" itemprop="name">{{ .Title }}</a>. + {{ if .Params.publication_short }} + {{- .Params.publication_short | markdownify -}}, + {{ else if .Params.publication }} + {{- .Params.publication | markdownify -}}, + {{ end }} + {{- .Date.Format "2006" -}}. + <p>{{ partial "page_links" (dict "page" . "is_list" 1) }}</p> + + {{ end }} +</div> diff --git a/layouts/partials/li_compact.html b/layouts/partials/li_compact.html new file mode 100644 index 0000000..fc60781 --- /dev/null +++ b/layouts/partials/li_compact.html @@ -0,0 +1,91 @@ +{{ $item := . }} + +{{ $microdata_type := "CreativeWork" }} +{{ $show_authors_only := false }}{{/* Show authors only or full metadata? */}} +{{ $show_buttons := false }} + +{{/* Dynamic view adjusts to content type. */}} +{{ if eq $item.Type "post" }} +{{ $microdata_type = "BlogPosting" }} +{{ else if eq $item.Type "talk" }} +{{ $microdata_type = "Event" }} +{{ $show_authors_only = true }} +{{ $show_buttons = true }} +{{ else if eq $item.Type "publication" }} +{{ $microdata_type = "ScholarlyArticle" }} +{{ $show_authors_only = true }} +{{ $show_buttons = true }} +{{ end }} + +{{/* Get summary. */}} +{{ $summary := "" }} +{{ if $item.Params.summary }} +{{ $summary = $item.Params.summary | markdownify | emojify }} +{{ else if .Params.abstract }} +{{ $summary = .Params.abstract | markdownify | emojify }} +{{ else if $item.Truncated }} +{{ $summary = $item.Summary }} +{{ end }} + + <div class="col-md-10 col-lg-8"> + <div class="media stream-item shadow p-4" itemscope itemtype="http://schema.org/{{$microdata_type}}"> + <div class="media-body"> + + <h3 class="article-title mb-0 mt-0" itemprop="name"> + <a href="{{ $item.RelPermalink }}" itemprop="url">{{ $item.Title }}</a> + </h3> + + {{ with $summary }} + <div class="article-style" itemprop="articleBody"> + {{ . | truncate 135 }} + </div> + {{ end }} + + <div class="stream-meta article-metadata"> + + {{ if eq $item.Type "talk" }} + <div> + <span itemprop="startDate"> + {{ $date := $item.Date }} + {{ (time $date).Format site.Params.date_format }} + {{ if not $item.Params.all_day }} + {{ (time $date).Format (site.Params.time_format | default "3:04 PM") }} + {{ with $item.Params.date_end }} + — {{ (time .).Format (site.Params.time_format | default "3:04 PM") }} + {{ end }} + {{ end }} + </span> + {{ with $item.Params.location }} + <span class="middot-divider"></span> + <span itemprop="location">{{ . }}</span> + {{ end }} + </div> + {{ end }} + + {{ if and $show_authors_only $item.Params.authors }} + <div itemprop="author"> + {{ partial "page_metadata_authors" $item }} + </div> + {{ else if not $show_authors_only }} + {{ partial "page_metadata" (dict "page" $item "is_list" 1) }} + {{ end }} + </div> + + {{ if $show_buttons }} + <div class="btn-links"> + {{ partial "page_links" (dict "page" $item "is_list" 1) }} + </div> + {{ end }} + + </div> + <div class="ml-3"> + {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }} + {{ with $resource }} + {{ $image := .Resize "250x" }} + <a href="{{ $item.RelPermalink }}"> + <img src="{{ $image.RelPermalink }}" itemprop="image"> + </a> + {{end}} + </div> + </div> + </div>
\ No newline at end of file diff --git a/layouts/partials/li_list.html b/layouts/partials/li_list.html new file mode 100644 index 0000000..11ddfee --- /dev/null +++ b/layouts/partials/li_list.html @@ -0,0 +1,56 @@ +{{ $item := . }} + +{{ $microdata_type := "CreativeWork" }} +{{ $icon := "fa-file-alt" }} +{{ $show_authors := false }} +{{ $show_buttons := false }} + +{{/* Dynamic view adjusts to content type. */}} +{{ if eq $item.Type "post" }} + {{ $microdata_type = "BlogPosting" }} + {{ $icon = "fa-newspaper" }} +{{ else if eq $item.Type "talk" }} + {{ $microdata_type = "Event" }} + {{ $icon = "fa-calendar-alt" }} +{{ else if eq $item.Type "publication" }} + {{ $microdata_type = "ScholarlyArticle" }} + {{ $show_authors = true }} + {{ $show_buttons = true }} +{{ end }} + +<div class="view-list-item" itemscope itemtype="http://schema.org/{{$microdata_type}}"> + <i class="far {{$icon}} pub-icon" aria-hidden="true"></i> + <a href="{{ $item.RelPermalink }}" itemprop="url"><span itemprop="name">{{ $item.Title }}</span></a> + + {{ if eq $item.Type "talk" }} + <div class="article-metadata"> + <span itemprop="startDate"> + {{ $date := $item.Date }} + {{ (time $date).Format site.Params.date_format }} + {{ if not $item.Params.all_day }} + {{ (time $date).Format (site.Params.time_format | default "3:04 PM") }} + {{ with $item.Params.date_end }} + — {{ (time .).Format (site.Params.time_format | default "3:04 PM") }} + {{ end }} + {{ end }} + </span> + {{ with $item.Params.location }} + <span class="middot-divider"></span> + <span itemprop="location">{{ . }}</span> + {{ end }} + </div> + {{ end }} + + {{ if and $show_authors $item.Params.authors }} + <div class="article-metadata" itemprop="author"> + {{ partial "page_metadata_authors" $item }} + </div> + {{ end }} + + {{ if $show_buttons }} + <div class="btn-links"> + {{ partial "page_links" (dict "page" $item "is_list" 1) }} + </div> + {{ end }} + +</div> diff --git a/layouts/partials/navbar.html b/layouts/partials/navbar.html new file mode 100644 index 0000000..00a2879 --- /dev/null +++ b/layouts/partials/navbar.html @@ -0,0 +1,133 @@ +{{ $current_page := . }} +<nav class="navbar navbar-light fixed-top navbar-expand-lg py-0" id="navbar-main"> + <div class="container"> + + <!-- Brand and toggle get grouped for better mobile display --> + <a class="navbar-brand" href="{{ "/" | relLangURL }}"> + {{- if site.Params.logo -}} + <img src="{{ printf "/img/%s" site.Params.logo | relURL }}" alt="{{ site.Title }}"> + {{- else -}} + {{- site.Title -}} + {{- end -}} + </a> + {{ if or site.Menus.main .IsTranslated }} + <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar" aria-controls="navbar" aria-expanded="false" aria-label="{{ i18n "toggle_navigation" }}"><span><i class="fas fa-bars"></i></span> + </button> + {{ end }} + + <!-- Collect the nav links, forms, and other content for toggling --> + <div class="collapse navbar-collapse" id="navbar"> + + <!-- Left Nav Bar --> + {{ $align_right := site.Params.menu_align_right | default true }} + <ul class="navbar-nav {{ if $align_right }}ml-auto{{ else }}mr-auto{{ end }}"> + {{ range site.Menus.main }} + + {{ if .HasChildren }} + <li class="nav-item dropdown"> + <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"> + {{- .Pre -}}<span>{{ .Name | safeHTML }}</span>{{- .Post -}} + <span class="caret"></span> + </a> + <ul class="dropdown-menu"> + {{ range .Children }} + <li class="dropdown-item my-0 py-0 mx-0 px-0"> + <a href="{{ .URL | relLangURL }}"{{ if $.IsHome }} data-target="{{ .URL }}"{{ end }}> + {{- .Pre -}}<span>{{ .Name | safeHTML }}</span>{{- .Post -}} + </a> + </li> + {{ end }} + </ul> + </li> + + {{ else }} + + {{/* Set target for link. */}} + {{ $.Scratch.Set "target" "" }} + {{ if gt (len .URL) 4 }} + {{ if eq "http" (slicestr .URL 0 4) }} + {{ $.Scratch.Set "target" " target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + {{ end }} + + {{/* Get active page. */}} + {{ $is_link_in_current_path := in $current_page.RelPermalink .URL }} + {{ $is_widget_page := or $current_page.IsHome (eq $current_page.Type "widget_page") }} + {{ $hash := findRE "#(.+)" .URL }} + {{ $is_same_page := $is_link_in_current_path }} + {{ if gt (len $hash) 0 }} + {{ $hash = index $hash 0 }} + {{ $hash_removed := replace .URL $hash "" }} + {{ if eq (len $hash_removed) 0 }} + {{ $hash_removed = "/" }}{{/* Add robustness for `/#SECTION` or `#SECTION` in `menus.toml`. */}} + {{ end }} + {{ $is_same_page = eq (path.Dir $current_page.RelPermalink) (path.Dir ($hash_removed|relLangURL)) }} + {{ end }} + + <li class="nav-item"> + <a class="nav-link {{if $is_link_in_current_path }} active{{end}}" href="{{.URL | relLangURL}}"{{ if and $is_widget_page $is_same_page }} data-target="{{$hash}}"{{ end }}{{ ($.Scratch.Get "target") | safeHTMLAttr }}> + {{- .Pre -}}<span>{{ .Name | safeHTML }}</span>{{- .Post -}} + </a> + </li> + + {{ end }} + {{ end }} + + {{ if not $align_right | and (.IsTranslated | or site.Menus.main_right | or site.Params.search.engine | or site.Params.day_night) }} + </ul> + <ul class="navbar-nav ml-auto"> + {{ end }} + + {{ range site.Menus.main_right }} + + {{/* Set target for link. */}} + {{ $.Scratch.Set "target" "" }} + {{ if gt (len .URL) 4 }} + {{ if eq "http" (slicestr .URL 0 4) }} + {{ $.Scratch.Set "target" " target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + {{ end }} + + <li class="nav-item"> + <a class="nav-link" href="{{ .URL | relLangURL }}"{{ if $.IsHome }} data-target="{{ .URL }}"{{ end }}{{ ($.Scratch.Get "target") | safeHTMLAttr }}> + {{- .Pre -}}<span>{{ .Name | safeHTML }}</span>{{- .Post -}} + </a> + </li> + + {{ end }} + + {{ if site.Params.search.engine }} + <li class="nav-item"> + <a class="nav-link js-search" href="#"><i class="fas fa-search" aria-hidden="true"></i></a> + </li> + {{ end }} + + {{ if .IsTranslated }} + <li class="nav-item dropdown"> + <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true"> + <i class="fas fa-globe" aria-hidden="true"></i> + <span>{{ index site.Data.i18n.languages .Lang }}</span> + </a> + <ul class="dropdown-menu"> + {{ range .Translations }} + <li class="dropdown-item my-0 py-0 mx-0 px-0"> + <a href="{{ .Permalink }}"{{ if $.IsHome }} data-target="{{ .URL }}"{{ end }}> + <span>{{ index site.Data.i18n.languages .Lang }}</span> + </a> + </li> + {{ end }} + </ul> + </li> + {{ end }} + + {{ if site.Params.day_night }} + <li class="nav-item"> + <a class="nav-link js-dark-toggle" href="#"><i class="fas fa-moon" aria-hidden="true"></i></a> + </li> + {{ end }} + + </ul> + + </div><!-- /.navbar-collapse --> + </div><!-- /.container --> +</nav> diff --git a/layouts/partials/page_author.html b/layouts/partials/page_author.html new file mode 100644 index 0000000..288f878 --- /dev/null +++ b/layouts/partials/page_author.html @@ -0,0 +1,65 @@ +{{/* Author profile box */}} + +{{ if not (or (eq site.Params.profile false) (eq .Params.profile false)) }} + +{{/* Display superuser if superuser exists and page authors are not explicitly specified. */}} +{{/* Otherwise, display first author if a profile for them exists. */}} + +{{ $author_urlized := "" }} +{{ if and (not .Params.authors) (.Scratch.Get "superuser_username") }} + {{ $author_urlized = (.Scratch.Get "superuser_username") }} +{{ else }} + {{ $first_author := "" }} + {{ if .Params.authors }} + {{ $first_author = index .Params.authors 0 }} + {{ end }} + {{ $author_urlized = urlize $first_author }} +{{ end }} + +{{ $taxonomy := "authors" }} +{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_urlized) }} +{{ with $profile_page }} + {{/* If it's a personal site and primary page author is superuser, link to the homepage rather than their profile page. */}} + {{ $profile_url := .RelPermalink }} + {{ if and (not site.Data.organization.name) (eq .Params.superuser true) }} + {{ $profile_url = site.BaseURL }} + {{ end }} + {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }} + <div class="media author-card" itemscope itemtype="http://schema.org/Person"> + {{ if and site.Params.gravatar .Params.email }} + <img class="portrait mr-3" src="https://s.gravatar.com/avatar/{{ md5 .Params.email }}?s=200')" itemprop="image" alt="Avatar"> + {{ else if $avatar }} + {{ $avatar_image := $avatar.Fill "250x250 Center" }} + <img class="portrait mr-3" src="{{ $avatar_image.RelPermalink }}" itemprop="image" alt="Avatar"> + {{ end }} + + <div class="media-body"> + <h5 class="card-title" itemprop="name"><a href="{{$profile_url}}">{{.Params.name}}</a></h5> + {{ with .Params.role }}<h6 class="card-subtitle">{{. | markdownify | emojify}}</h6>{{end}} + {{ with .Params.bio }}<p class="card-text" itemprop="description">{{. | markdownify | emojify}}</p>{{end}} + <ul class="network-icon" aria-hidden="true"> + {{ range .Params.social }} + {{ $pack := or .icon_pack "fas" }} + {{ $pack_prefix := $pack }} + {{ if in (slice "fab" "fas" "far" "fal") $pack }} + {{ $pack_prefix = "fa" }} + {{ end }} + {{ $link := .link }} + {{ $scheme := (urls.Parse $link).Scheme }} + {{ $target := "" }} + {{ if not $scheme }} + {{ $link = .link | relLangURL }} + {{ else if in (slice "http" "https") $scheme }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + <li> + <a itemprop="sameAs" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}> + <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }}"></i> + </a> + </li> + {{end}} + </ul> + </div> + </div> +{{end}}{{/* Profile page block */}} +{{end}}{{/* Show profile block */}} diff --git a/layouts/partials/page_header.html b/layouts/partials/page_header.html new file mode 100644 index 0000000..1c3e6f7 --- /dev/null +++ b/layouts/partials/page_header.html @@ -0,0 +1,62 @@ +{{ $page := . }} +{{ $featured := (.Resources.ByType "image").GetMatch "*featured*" }} +{{ $anchor := $page.Params.image.focal_point | default "Smart" }} + +{{/* Set default titles for node pages */}} +{{ $title := .Title }} +{{ if and (not $title) .IsNode }} +{{ if eq .Type "post" }} +{{ $title = i18n "posts" }} +{{ else if eq .Type "talk" }} +{{ $title = i18n "talks" }} +{{ else if eq .Type "publication" }} +{{ $title = i18n "publications" }} +{{end}} +{{end}} + +{{/* Header image */}} + + +{{/* Featured image */}} +{{ if and $featured (not .Params.image.preview_only) }} +{{ $image := $featured.Fill (printf "680x500 q90 %s" $anchor) }} +<div class="container split-header"> + <div class="row justify-content-center"> + <div class="col-lg-8"> + <img class="img-fluid w-100" src="{{ $image.RelPermalink }}" itemprop="image" alt=""> + {{ with $.Params.image.caption }}<span + class="article-header-caption">{{ . | markdownify | emojify }}</span>{{ end }} + </div> + <div class="col-lg-8"> + <h1 itemprop="name">{{ $title }}</h1> + + {{ with $page.Params.subtitle }} + <p class="page-subtitle">{{ . | markdownify | emojify }}</p> + {{end}} + + {{ partial "page_metadata" (dict "page" $page "is_list" 0 "share" true) }} + {{ partial "page_links_div.html" $page }} + </div> + {{else}} + {{/* Case when page has no image */}} + + {{/* Wider container for nodes */}} + {{ $ctnr := "article-container" }} + {{ if $page.IsNode }} + {{ $ctnr = "universal-wrapper" }} + {{end}} + <div class="{{$ctnr}} py-3"> + <h1 itemprop="name">{{ $title }}</h1> + + {{ with $page.Params.subtitle }} + <p class="page-subtitle">{{ . | markdownify | emojify }}</p> + {{end}} + + {{ if not .IsNode }} + {{ partial "page_metadata" (dict "page" $page "is_list" 0 "share" true) }} + {{ partial "page_links_div.html" $page }} + {{end}} + {{end}} + </div> + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/page_links.html b/layouts/partials/page_links.html new file mode 100644 index 0000000..4e88aa4 --- /dev/null +++ b/layouts/partials/page_links.html @@ -0,0 +1,158 @@ +{{ $is_list := .is_list }} +{{ $page := .page }} +{{ $link := "" }} + +{{/* ***** TODO: Deprecate `url_preprint` in favour of `url_pdf` given there's now a dedicated "Preprint" pub. type. ***** */}} +{{ with $page.Params.url_preprint }} + {{ $resource := $page.Resources.GetMatch . }} + {{ if $resource }} + {{ $link = $resource.RelPermalink }} + {{ else }} + {{ $link = . | relURL }} + {{ end }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener"> + {{ i18n "btn_preprint" }} +</a> +{{ end }} +{{ $pdf := "" }} +{{ $resource := $page.Resources.GetMatch (printf "%s.pdf" $page.File.ContentBaseName) }} +{{ with $resource }} + {{ $pdf = .RelPermalink }} +{{ else }} + {{ if $page.Params.url_pdf }} + {{ $pdf = $page.Params.url_pdf | relURL }} + {{ end }} +{{ end }} + +{{ with $pdf }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . }}" target="_blank" rel="noopener"> + {{ i18n "btn_pdf" }} +</a> +{{ end }} +{{ $resource := $page.Resources.GetMatch "cite.bib" }} +{{ with $resource }} +<button type="button" class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}} js-cite-modal" + data-filename="{{ .RelPermalink }}"> + {{ i18n "btn_cite" }} +</button> +{{ end }} +{{ with $page.Params.url_code }} + {{ $resource := $page.Resources.GetMatch . }} + {{ if $resource }} + {{ $link = $resource.RelPermalink }} + {{ else }} + {{ $link = . | relURL }} + {{ end }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener"> + {{ i18n "btn_code" }} +</a> +{{ end }} +{{ with $page.Params.url_dataset }} + {{ $resource := $page.Resources.GetMatch . }} + {{ if $resource }} + {{ $link = $resource.RelPermalink }} + {{ else }} + {{ $link = . | relURL }} + {{ end }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener"> + {{ i18n "btn_dataset" }} +</a> +{{ end }} +{{ if $page.Params.projects }} +{{ range $page.Params.projects }} + {{ with (site.GetPage (printf "project/%s" .)) }} + <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ .RelPermalink }}"> + {{ i18n "btn_project" }} + </a> + {{ else }} + {{/* errorf "The `projects` parameter in `content/%s` references a project file, `content/project/%s`, which cannot be found. Please either set `projects = []` or fix the reference." $page.File.Path . */}} + {{ end }} +{{ end }} +{{ else }} +{{ with $page.Params.url_project }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ . }}" target="_blank" rel="noopener"> + {{ i18n "btn_project" }} +</a> +{{ end }} +{{ end }} +{{ with $page.Params.url_poster }} + {{ $resource := $page.Resources.GetMatch . }} + {{ if $resource }} + {{ $link = $resource.RelPermalink }} + {{ else }} + {{ $link = . | relURL }} + {{ end }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener"> + {{ i18n "btn_poster" }} +</a> +{{ end }} +{{ if $page.Params.slides }} + {{ with (site.GetPage (printf "slides/%s" $page.Params.slides)) }} + <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ .RelPermalink }}" target="_blank"> + {{ i18n "btn_slides" }} + </a> + {{ end }} +{{ else }} +{{ with $page.Params.url_slides }} + {{ $resource := $page.Resources.GetMatch . }} + {{ if $resource }} + {{ $link = $resource.RelPermalink }} + {{ else }} + {{ $link = . | relURL }} + {{ end }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener"> + {{ i18n "btn_slides" }} +</a> +{{ end }} +{{ end }} +{{ with $page.Params.url_video }} + {{ $resource := $page.Resources.GetMatch . }} + {{ if $resource }} + {{ $link = $resource.RelPermalink }} + {{ else }} + {{ $link = . | relURL }} + {{ end }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener"> + {{ i18n "btn_video" }} +</a> +{{ end }} +{{ with $page.Params.url_source }} + {{ $resource := $page.Resources.GetMatch . }} + {{ if $resource }} + {{ $link = $resource.RelPermalink }} + {{ else }} + {{ $link = . | relURL }} + {{ end }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link }}" target="_blank" rel="noopener"> + {{ i18n "btn_source" }} +</a> +{{ end }} +{{ with $page.Params.doi }} +<a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="https://doi.org/{{ . }}" target="_blank" rel="noopener"> + DOI +</a> +{{ end }} +{{ range $page.Params.links }} + {{ $pack := or .icon_pack "fas" }} + {{ $pack_prefix := $pack }} + {{ if in (slice "fab" "fas" "far" "fal") $pack }} + {{ $pack_prefix = "fa" }} + {{ end }} + {{ $link := .url | default "" }} + {{ $scheme := (urls.Parse $link).Scheme }} + {{ $target := "" }} + {{ if not $scheme }} + {{ $resource := $page.Resources.GetMatch $link }} + {{ if $resource }} + {{ $link = $resource.RelPermalink }} + {{ else }} + {{ $link = $link | relURL }} + {{ end }} + {{ else if in (slice "http" "https") $scheme }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + <a class="btn btn-outline-primary my-1 mr-1{{ if $is_list }} btn-sm{{end}}" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}> + {{ if .icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }} {{if .name}}mr-1{{end}}"></i>{{end}} + {{ with .name }}{{ . | safeHTML }}{{end}} + </a> +{{ end }} diff --git a/layouts/partials/page_links_div.html b/layouts/partials/page_links_div.html new file mode 100644 index 0000000..9d177fc --- /dev/null +++ b/layouts/partials/page_links_div.html @@ -0,0 +1,25 @@ +{{/* Div wrapper around page links. */}} +{{/* The wrapper is hidden when the page has no link buttons. */}} + +{{ $page := . }} +{{ $pdf_link := false }} +{{ $cite_link := false }} +{{ $slug := $page.File.ContentBaseName }} +{{ $resource := $page.Resources.GetMatch (printf "%s.pdf" $slug) }} +{{ with $resource }} + {{ $pdf_link = true }} +{{ end }} + +{{ $resource := $page.Resources.GetMatch "cite.bib" }} +{{ with $resource }} + {{ $cite_link = true }} +{{ end }} + +{{ if $cite_link | or $pdf_link | or .Params.external_link | or .Params.url_preprint | or .Params.url_pdf | or .Params.url_slides | or .Params.url_video | or .Params.url_source | or .Params.url_code | or .Params.url_dataset | or .Params.url_poster | or .Params.url_project | or .Params.links | or .Params.projects | or .Params.slides }} +<div class="btn-links mb-3"> + {{ with .Params.external_link }} + <a class="btn btn-outline-primary my-1" href="{{ . }}" target="_blank" rel="noopener">{{ i18n "open_project_site" }}</a> + {{ end }} + {{ partial "page_links" (dict "page" $page "is_list" 0) }} +</div> +{{ end }} diff --git a/layouts/partials/page_metadata.html b/layouts/partials/page_metadata.html new file mode 100644 index 0000000..32d2987 --- /dev/null +++ b/layouts/partials/page_metadata.html @@ -0,0 +1,74 @@ +{{ $is_list := .is_list }} +{{ $share := .share | default false }} +{{ $page := .page }} + +<meta content="{{ $page.Params.Date }}" itemprop="datePublished"> +<meta content="{{ $page.Params.LastMod }}" itemprop="dateModified"> + +<div class="article-metadata"> + + {{/* If `authors` is set and is not empty. */}} + {{ if $page.Params.authors }} + {{ $authorLen := len $page.Params.authors }} + {{ if gt $authorLen 0 }} + <div> + {{ partial "page_metadata_authors" $page }} + </div> + {{ end }} + {{ end }} + + {{ if not (in (slice "talk" "page") $page.Type) }} + <span class="article-date"> + {{ $date := $page.Lastmod.Format site.Params.date_format }} + {{ if eq $page.Type "publication" }} + {{ $date = $page.Date.Format (site.Params.publications.date_format | default "January, 2006") }} + {{ else }} + {{ if ne $page.Params.Lastmod $page.Params.Date }} + {{ i18n "last_updated" }} + {{ end }} + {{ end }} + <time>{{ $date }}</time> + </span> + {{ end }} + + {{ if and (eq $is_list 1) (eq $page.Type "publication") }} + <span class="middot-divider"></span> + <span class="pub-publication"> + {{ if $page.Params.publication_short }} + {{ $page.Params.publication_short | markdownify }} + {{ else if $page.Params.publication }} + {{ $page.Params.publication | markdownify }} + {{ end }} + </span> + {{ end }} + + {{ if and (eq $page.Type "post") (not (or (eq site.Params.reading_time false) (eq $page.Params.reading_time false))) }} + <span class="middot-divider"></span> + <span class="article-reading-time"> + {{ $page.ReadingTime }} {{ i18n "minute_read" }} + </span> + {{ end }} + + {{ $comments_enabled := and site.DisqusShortname (not (or site.Params.disable_comments (eq $page.Params.comments false))) }} + {{ if and $comments_enabled (site.Params.comment_count | default true) }} + <span class="middot-divider"></span> + <a href="{{ $page.RelPermalink }}#disqus_thread"><!-- Count will be inserted here --></a> + {{ end}} + + {{ $taxonomy := "categories" }} + {{ with $page.Param $taxonomy }} + <span class="middot-divider"></span> + <span class="article-categories"> + <i class="fas fa-folder"></i> + {{ range $index, $value := . -}} + {{- if gt $index 0 }}, {{ end -}} + <a href="{{ (site.GetPage (printf "/%s/%s" $taxonomy (. | urlize))).RelPermalink }}">{{ . }}</a> + {{- end -}} + </span> + {{ end }} + + {{ if $share }} + {{ partial "share.html" $page }} + {{ end }} + +</div> diff --git a/layouts/partials/page_metadata_authors.html b/layouts/partials/page_metadata_authors.html new file mode 100644 index 0000000..acf3789 --- /dev/null +++ b/layouts/partials/page_metadata_authors.html @@ -0,0 +1,17 @@ +{{/* Display author list. */}} + +{{ $taxonomy := "authors" }} +{{ with .Param $taxonomy }} + {{ range $index, $value := . }} + {{- $profile_page := site.GetPage (printf "/%s/%s" $taxonomy (. | urlize)) -}} + {{- $name := $profile_page.Params.name | default ($value|markdownify) -}} + {{- if gt $index 0 }}, {{ end -}} + <span itemprop="author name" itemtype="http://schema.org/Person"> + {{- with $profile_page -}} + <a href="{{.RelPermalink}}">{{$name}}</a> + {{- else -}} + {{$name}} + {{- end -}} + </span> + {{- end -}} +{{ end }} diff --git a/layouts/partials/pagination.html b/layouts/partials/pagination.html new file mode 100644 index 0000000..91c521a --- /dev/null +++ b/layouts/partials/pagination.html @@ -0,0 +1,12 @@ +{{ if or (.Paginator.HasPrev) (.Paginator.HasNext) }} +<nav> + <ul class="pagination justify-content-center"> + {{ if .Paginator.HasPrev }} + <li class="page-item"><a class="page-link" href="{{ .Paginator.Prev.URL }}">«</a></li> + {{ end }} + {{ if .Paginator.HasNext }} + <li class="page-item"><a class="page-link" href="{{ .Paginator.Next.URL }}">»</a></li> + {{ end }} + </ul> +</nav> +{{ end }} diff --git a/layouts/partials/project_li_card.html b/layouts/partials/project_li_card.html new file mode 100644 index 0000000..860eee2 --- /dev/null +++ b/layouts/partials/project_li_card.html @@ -0,0 +1,25 @@ +{{ $item := .item }} +{{ $widget := .widget }} + +{{ $link := .link }} +{{ $target := .target }} + +{{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }} +{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }} + +<div class="project-card project-item isotope-item {{ $js_tag_classes | safeHTMLAttr }}"> + <div class="card rounded-0 shadow-sm"> + {{ with $resource }} + {{ $image := .Resize (printf "550x q90 %s") }} + <a href="{{ $link }}" {{ $target | safeHTMLAttr }} class="card-image"> + <img src="{{ $image.RelPermalink }}" alt="" class="img-responsive"> + </a> + {{ end }} + <div class="card-body"> + <h4><a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{ $item.Title | markdownify | emojify }}</a></h4> + <div class="card-desription"> + {{ with $item.Params.summary }}<p>{{ . | markdownify | emojify }}</p>{{ end }} + </div> + </div> + </div> +</div> diff --git a/layouts/partials/project_li_list.html b/layouts/partials/project_li_list.html new file mode 100644 index 0000000..dd73934 --- /dev/null +++ b/layouts/partials/project_li_list.html @@ -0,0 +1,15 @@ +{{ $item := .item }} +{{ $widget := .widget }} +{{ $link := .link }} +{{ $target := .target }} +{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }} + +<div class="col-lg-12 project-item isotope-item {{ $js_tag_classes | safeHTMLAttr }}" itemscope itemtype="http://schema.org/CreativeWork"> + <i class="far fa-copy pub-icon" aria-hidden="true"></i> + + <span class="project-title"> + <a href="{{ $link }}" {{ $target | safeHTMLAttr }} itemprop="url">{{ $item.Title | markdownify | emojify }}</a> + </span> + + {{ with $item.Params.summary }}<p class="project-summary">{{ . | markdownify | emojify }}</p>{{ end }} +</div> diff --git a/layouts/partials/project_li_showcase.html b/layouts/partials/project_li_showcase.html new file mode 100644 index 0000000..0e88495 --- /dev/null +++ b/layouts/partials/project_li_showcase.html @@ -0,0 +1,57 @@ +{{ $item := .item }} +{{ $widget := .widget }} + +{{ $do_link := true }} +{{ if $item.Params.external_link | or $item.Content }} + {{ $do_link = true }} +{{ else }} + {{ $do_link = false }} +{{ end }} + +{{ $link := .link }} +{{ $target := .target }} + +{{ $order := "" }} +{{ if and ($widget.Params.design.flip_alt_rows | default true) (not (modBool .index 2)) }} + {{ $order = "order-md-2" }} +{{ end }} + +{{ $js_tag_classes := delimit (apply (apply $item.Params.tags "replace" "." " " "-") "printf" "js-id-%s" ".") " " }} + +<div class="col-lg-12 project-item isotope-item {{ $js_tag_classes | safeHTMLAttr }}" itemscope itemtype="http://schema.org/CreativeWork"> + <div class="row align-items-center"> + <div class="col-12 col-md-6"> + <h3 class="article-title mb-0 mt-0" itemprop="name"> + {{- if $do_link}}<a href="{{ $link }}" {{ $target | safeHTMLAttr }} itemprop="url">{{end -}} + {{ $item.Title | markdownify | emojify }} + {{- if $do_link}}</a>{{end -}} + </h3> + + {{ $summary := "" }} + {{ if $item.Params.summary }} + {{ $summary = $item.Params.summary }} + {{ else if $item.Truncated }} + {{ $summary = $item.Summary }} + {{ end }} + {{ with $summary }} + <div class="article-style" itemprop="articleBody"> + {{ . | markdownify | emojify }} + </div> + {{ end }} + + <div class="btn-links"> + {{ partial "page_links" (dict "page" $item "is_list" 0) }} + </div> + + </div> + <div class="col-12 col-md-6 order-first {{$order}}"> + {{ $resource := ($item.Resources.ByType "image").GetMatch "*featured*" }} + {{ with $resource }} + {{ $image := .Resize "540x" }} + {{if $do_link}}<a href="{{ $link }}" {{ $target | safeHTMLAttr }}>{{end}} + <img src="{{ $image.RelPermalink }}" itemprop="image" alt=""> + {{if $do_link}}</a>{{end}} + {{end}} + </div> + </div> +</div> diff --git a/layouts/partials/search.html b/layouts/partials/search.html new file mode 100644 index 0000000..bcbfc38 --- /dev/null +++ b/layouts/partials/search.html @@ -0,0 +1,32 @@ +<aside class="search-results" id="search"> + <div class="container"> + <section class="search-header"> + + <div class="row no-gutters justify-content-between mb-3"> + <div class="col-6"> + <h1>{{ i18n "search" }}</h1> + </div> + <div class="col-6 col-search-close"> + <a class="js-search" href="#"><i class="fas fa-times-circle text-muted" aria-hidden="true"></i></a> + </div> + </div> + + <div id="search-box"> + {{ if eq site.Params.search.engine 1 }} + <input name="q" id="search-query" placeholder="{{i18n "search_placeholder"}}" autocapitalize="off" + autocomplete="off" autocorrect="off" role="textbox" spellcheck="false" type="search"> + {{ else }} + <!-- Search box will appear here --> + {{ end }} + </div> + + </section> + <section class="section-search-results"> + + <div id="search-hits"> + <!-- Search results will appear here --> + </div> + + </section> + </div> +</aside> diff --git a/layouts/partials/section_pager.html b/layouts/partials/section_pager.html new file mode 100644 index 0000000..3f082d6 --- /dev/null +++ b/layouts/partials/section_pager.html @@ -0,0 +1,18 @@ +{{ $str := "" }} +<div class="post-nav"> + {{if .NextInSection}} + {{/* For the docs layout, prev/next labels are reversed. */}} + {{ if eq .Type "docs" }}{{ $str = "previous" }}{{else}}{{ $str = "next" }}{{end}} + <div class="post-nav-item"> + <div class="meta-nav">{{ i18n $str }}</div> + <a href="{{.NextInSection.RelPermalink}}" rel="next">{{.NextInSection.Title}}</a> + </div> + {{end}} + {{if .PrevInSection}} + {{ if eq .Type "docs" }}{{ $str = "next" }}{{else}}{{ $str = "previous" }}{{end}} + <div class="post-nav-item"> + <div class="meta-nav">{{ i18n $str }}</div> + <a href="{{.PrevInSection.RelPermalink}}" rel="prev">{{.PrevInSection.Title}}</a> + </div> + {{end}} +</div> diff --git a/layouts/partials/share.html b/layouts/partials/share.html new file mode 100644 index 0000000..979c375 --- /dev/null +++ b/layouts/partials/share.html @@ -0,0 +1,20 @@ +{{ if and site.Params.sharing (ne .Params.share false) }} +<div class="share-box" aria-hidden="true"> + <ul class="share"> + {{ range where site.Data.page_sharer.buttons "enable" true }} + {{ $pack := or .icon_pack "fas" }} + {{ $pack_prefix := $pack }} + {{ if in (slice "fab" "fas" "far" "fal") $pack }} + {{ $pack_prefix = "fa" }} + {{ end }} + {{ $link := replace .url "{url}" ($.Permalink | htmlEscape) }} + {{ $link = replace $link "{title}" ($.Title | htmlEscape) }} + <li> + <a href="{{$link|safeURL}}" target="_blank" rel="noopener" class="share-btn-{{.id}}"> + <i class="{{$pack}} {{$pack_prefix}}-{{.icon}}"></i> + </a> + </li> + {{ end }} + </ul> +</div> +{{ end }} diff --git a/layouts/partials/site_footer.html b/layouts/partials/site_footer.html new file mode 100644 index 0000000..5fddf3e --- /dev/null +++ b/layouts/partials/site_footer.html @@ -0,0 +1,43 @@ +<footer class="site-footer"> + + <div class="container"> + <div class="row"> + <div class="col-md-6"> + {{ with site.GetPage "privacy.md" }} + <p class="powered-by"> + {{ printf "<a href=\"%s\">%s</a>" .RelPermalink .Title | safeHTML }} + </p> + {{ end }} + <p> + {{ with site.Copyright }}{{ replace . "{year}" now.Year | markdownify}} · {{ end }} + Powered by + <a href="https://themefisher.com" target="_blank" rel="noopener">themefisher</a> for + <a href="https://gohugo.io" target="_blank" rel="noopener">Hugo</a>. + </p> + </div> + <div class="col-md-6"> + <ul class="list-inline network-icon text-right"> + {{/* Contact links. */}} + {{ range site.Params.contact_links }} + {{ $pack := or .icon_pack "fas" }} + {{ $pack_prefix := $pack }} + {{ if in (slice "fab" "fas" "far" "fal") $pack }} + {{ $pack_prefix = "fa" }} + {{ end }} + {{ $link := .link }} + {{ $scheme := (urls.Parse $link).Scheme }} + {{ $target := "" }} + {{ if not $scheme }} + {{ $link = .link | relLangURL }} + {{ else if in (slice "http" "https") $scheme }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + <li class="list-inline-item"> + <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} title="{{.name}}"><i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }}" aria-hidden="true"></i></a> + </li> + {{ end }} + </ul> + </div> + </div> + </div> +</footer>
\ No newline at end of file diff --git a/layouts/partials/site_head.html b/layouts/partials/site_head.html new file mode 100644 index 0000000..ef74e1e --- /dev/null +++ b/layouts/partials/site_head.html @@ -0,0 +1,193 @@ +<head> + + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="generator" content="Source Themes Academia {{ site.Data.academic.version }}"> + {{ hugo.Generator}} + + {{ $scr := .Scratch }} + + {{/* Attempt to load superuser. */}} + {{ $superuser_name := "" }} + {{ $superuser_username := "" }} + {{ $superuser_role := "" }} + {{ range first 1 (where (where site.Pages "Section" "authors") "Params.superuser" true) }} + {{ $superuser_name = .Params.name }} + {{ $superuser_username = path.Base (path.Split .Path).Dir }} + {{ $superuser_role = .Params.role }} + {{ end }} + {{ $scr.Set "superuser_username" $superuser_username }}{{/* For access from page_author.html. */}} + + {{ with $superuser_name }}<meta name="author" content="{{ . }}">{{ end }} + + {{/* Generate page description. */}} + {{ $desc := "" }} + {{ if .Params.summary }} + {{ $desc = .Params.summary }} + {{ else if .Params.abstract }} + {{ $desc = .Params.abstract }} + {{ else if .IsPage }} + {{ $desc = .Summary }} + {{ else if site.Params.description }} + {{ $desc = site.Params.description }} + {{ else }} + {{ $desc = $superuser_role }} + {{ end }} + <meta name="description" content="{{ $desc }}"> + + {{ range .Translations }} + <link rel="alternate" hreflang="{{ .Lang }}" href="{{ .Permalink }}"> + {{ end }} + <link rel="alternate" hreflang="{{ site.LanguageCode | default "en-us" }}" href="{{ .Permalink }}"> + + {{ partial "functions/parse_theme" . }} + {{ $css := site.Data.assets.css }} + {{ $js := site.Data.assets.js }} + {{ if ne ($scr.Get "primary") "#fff" }} + <meta name="theme-color" content="{{ $scr.Get "primary" }}"> + {{ end }} + + {{/* Attempt to load local vendor CSS, otherwise load from CDN. */}} + {{ $scr.Set "vendor_css_filename" "main.min.css" }} + {{ $scr.Set "vendor_js_filename" "main.min.js" }} + {{ if and (fileExists (printf "static/css/vendor/%s" ($scr.Get "vendor_css_filename"))) (fileExists (printf "static/js/vendor/%s" ($scr.Get "vendor_js_filename"))) }} + {{ $scr.Set "use_cdn" 0 }} + <link rel="stylesheet" href="{{ printf "/css/vendor/%s" ($scr.Get "vendor_css_filename") | relURL }}"> + {{ else }} + {{ $scr.Set "use_cdn" 1 }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.academicons.url $css.academicons.version) $css.academicons.sri | safeHTML }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fontAwesome.url $css.fontAwesome.version) $css.fontAwesome.sri | safeHTML }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.fancybox.url $css.fancybox.version) $css.fancybox.sri | safeHTML }} + + {{/* Default to enabling highlighting, but allow the user to override it in .Params or site.Params. + Use $scr to store "highlight_enabled", so that we can read it again in footer.html. */}} + {{ $scr.Set "highlight_enabled" true }} + {{ if isset .Params "highlight" }} + {{ $scr.Set "highlight_enabled" .Params.highlight }} + {{ else if isset site.Params "highlight" }} + {{ $scr.Set "highlight_enabled" site.Params.highlight }} + {{ end }} + {{ if ($scr.Get "highlight_enabled") }} + {{ $v := $css.highlight.version }} + {{ with site.Params.highlight_style }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\">" (printf $css.highlight.url $css.highlight.version .) | safeHTML }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" disabled>" (printf $css.highlight.url $css.highlight.version .) | safeHTML }} + {{ else }} + {{ if eq ($scr.Get "light") true }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\">" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\" disabled>" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }} + {{ else }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-light\" disabled>" (printf $css.highlight.url $css.highlight.version "github") | safeHTML }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\" title=\"hl-dark\">" (printf $css.highlight.url $css.highlight.version "dracula") | safeHTML }} + {{ end }} + {{ end }} + {{ end }} + + {{ if or (eq site.Params.map 2) (eq site.Params.map 3) }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.leaflet.url $css.leaflet.version) $css.leaflet.sri | safeHTML }} + {{ end }} + + {{ if eq site.Params.search.engine 2 }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.instantsearch.url $css.instantsearch.version) $css.instantsearch.sri | safeHTML }} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.instantsearchTheme.url $css.instantsearchTheme.version) $css.instantsearchTheme.sri | safeHTML }} + {{ end }} + + {{ end }} + + {{/* We cannot use SRI with Google Fonts because the CSS is dynamically generated according to the user agent. */}} + {{ with ($scr.Get "google_fonts") }} + <link rel="stylesheet" {{ printf "href=\"https://fonts.googleapis.com/css?family=%s&display=swap\"" . | safeHTMLAttr }}> + {{ end }} + + {{ $css_options := (dict "targetPath" "css/academic.css" "outputStyle" "compressed") }} + {{ $sass_template := resources.Get "sass/main.scss" }} + {{ $style := $sass_template | resources.ExecuteAsTemplate "main_parsed.scss" . | toCSS $css_options | minify | fingerprint "md5" }} + <link rel="stylesheet" href="{{ $style.RelPermalink }}"> + + {{ if site.Params.plugins_css }} + {{ $css_comment := printf "/* Source Themes Academic v%s | https://sourcethemes.com/academic/ */\n" site.Data.academic.version }} + {{ $css_bundle_head := $css_comment | resources.FromString "css/bundle-head.css" }} + {{ $css_bundle := slice }} + {{ range site.Params.plugins_css }} + {{ $css_bundle = $css_bundle | append (resources.Get (printf "css/%s.css" .)) }} + {{ end }} + {{ $css_bundle := $css_bundle | resources.Concat "css/academic-bundle-pre.css" | minify }} + {{ $css_bundle := slice $css_bundle_head $css_bundle | resources.Concat "css/academic.css" | fingerprint "md5" }} + <link rel="stylesheet" href="{{ $css_bundle.RelPermalink }}"> + {{ end }} + + {{ if not site.IsServer }} + {{ if site.GoogleAnalytics }} + <script> + window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date; + ga('create', '{{ site.GoogleAnalytics }}', 'auto'); + {{ if site.Params.privacy_pack }}ga('set', 'anonymizeIp', true);{{ end }} + ga('require', 'eventTracker'); + ga('require', 'outboundLinkTracker'); + ga('require', 'urlChangeTracker'); + ga('send', 'pageview'); + </script> + <script async src="//www.google-analytics.com/analytics.js"></script> + {{ if ($scr.Get "use_cdn") }} + {{ printf "<script async src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.autotrack.url $js.autotrack.version) $js.autotrack.sri | safeHTML }} + {{ end }} + {{ end }} + {{ end }} + + {{ with .OutputFormats.Get "RSS" }} + <link rel="alternate" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ site.Title }}"> + <link rel="feed" href="{{ .RelPermalink }}" type="application/rss+xml" title="{{ site.Title }}"> + {{ end }} + + <link rel="manifest" href="{{ "site.webmanifest" | relURL }}"> + <link rel="icon" type="image/png" href="{{ "/img/icon.png" | relURL }}"> + <link rel="apple-touch-icon" type="image/png" href="{{ "/img/icon-192.png" | relURL }}"> + + <link rel="canonical" href="{{ .Permalink }}"> + + {{ $featured_image := (.Resources.ByType "image").GetMatch "*featured*" }} + {{ $og_image := "" }} + {{ $twitter_card := "summary_large_image" }} + {{ if $featured_image }} + {{ $og_image = $featured_image.Permalink }} + {{ else if .Params.header.image }} + {{ $og_image = printf "img/%s" .Params.header.image | absURL }} + {{ else if site.Params.sharing_image }} + {{ $og_image = printf "img/%s" site.Params.sharing_image | absURL }} + {{ else if site.Params.avatar }} + {{ $og_image = (printf "img/%s" site.Params.avatar) | absURL }} + {{ $twitter_card = "summary" }} + {{ else }} + {{ $og_image = "img/icon-192.png" | absURL }} + {{ $twitter_card = "summary" }} + {{ end }} + <meta property="twitter:card" content="{{ $twitter_card }}"> + {{ with site.Params.twitter }} + <meta property="twitter:site" content="@{{ . }}"> + <meta property="twitter:creator" content="@{{ . }}"> + {{ end }} + <meta property="og:site_name" content="{{ site.Title }}"> + <meta property="og:url" content="{{ .Permalink }}"> + <meta property="og:title" content="{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ site.Title }}"> + <meta property="og:description" content="{{ $desc }}"> + {{- with $og_image -}} + <meta property="og:image" content="{{.}}"> + <meta property="twitter:image" content="{{.}}"> + {{- end -}} + <meta property="og:locale" content="{{ site.LanguageCode | default "en-us" }}"> + {{ if .IsPage }} + {{ if not .PublishDate.IsZero }}<meta property="article:published_time" content="{{ .PublishDate.Format "2006-01-02T15:04:05-07:00" | safeHTML }}"> + {{ else if not .Date.IsZero }}<meta property="article:published_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}">{{ end }} + {{ if not .Lastmod.IsZero }}<meta property="article:modified_time" content="{{ .Lastmod.Format "2006-01-02T15:04:05-07:00" | safeHTML }}">{{ end }} + {{ else }} + {{ if not .Date.IsZero }}<meta property="og:updated_time" content="{{ .Date.Format "2006-01-02T15:04:05-07:00" | safeHTML }}">{{ end }} + {{ end }} + + {{ partial "cookie_consent" . }} + + {{ partial "custom_head" . }} + + <title>{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ site.Title }}</title> + +</head> diff --git a/layouts/partials/site_js.html b/layouts/partials/site_js.html new file mode 100644 index 0000000..7558f43 --- /dev/null +++ b/layouts/partials/site_js.html @@ -0,0 +1,153 @@ + {{ $scr := $.Scratch }} + + {{/* Config LaTeX math rendering. */}} + {{ if or .Params.math site.Params.math }} + {{ $mathjax_config := resources.Get "js/mathjax-config.js" }} + <script src="{{ $mathjax_config.RelPermalink }}"></script> + {{ end }} + + {{/* Attempt to load local vendor JS, otherwise load from CDN. */}} + {{ $js := site.Data.assets.js }} + {{ if not ($scr.Get "use_cdn") }} + <script src="{{ printf "/js/vendor/%s" ($scr.Get "vendor_js_filename") | relURL }}"></script> + {{ else }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.jQuery.url $js.jQuery.version) $js.jQuery.sri | safeHTML }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.imagesLoaded.url $js.imagesLoaded.version) $js.imagesLoaded.sri | safeHTML }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.isotope.url $js.isotope.version) $js.isotope.sri | safeHTML }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.fancybox.url $js.fancybox.version) $js.fancybox.sri | safeHTML }} + + {{ if or .Params.diagram site.Params.diagram }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" title=\"mermaid\"></script>" (printf $js.mermaid.url $js.mermaid.version) $js.mermaid.sri | safeHTML }} + {{ end }} + + {{ if $.Scratch.Get "highlight_enabled" }} + {{ $v := $js.highlight.version }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.highlight.url $v) $js.highlight.sri | safeHTML }} + {{ range site.Params.highlight_languages }} + <script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/{{ $v }}/languages/{{ . }}.min.js"></script> + {{ end }} + {{ end }} + + {{/* LaTeX math rendering. */}} + {{ if or .Params.math site.Params.math }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" async></script>" (printf $js.mathJax.url $js.mathJax.version) $js.mathJax.sri | safeHTML }} + {{ end }} + {{ end }} + + {{/* Maps JS. */}} + {{ if eq site.Params.map 1 }} + <script async defer src="//maps.googleapis.com/maps/api/js?key={{ site.Params.map_api_key }}"></script> + {{ if ($scr.Get "use_cdn") }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.gmaps.url $js.gmaps.version) $js.gmaps.sri | safeHTML }} + {{ end }} + {{ else if and (or (eq site.Params.map 2) (eq site.Params.map 3)) ($scr.Get "use_cdn") }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.leaflet.url $js.leaflet.version) $js.leaflet.sri | safeHTML }} + {{ end }} + + {{/* Comments JS. */}} + {{ $comments_enabled := and site.DisqusShortname (not (or site.Params.disable_comments $.Params.disable_comments)) }} + {{ if and $comments_enabled (site.Params.comment_count | default true) }} + <script id="dsq-count-scr" src="//{{ site.DisqusShortname }}.disqus.com/count.js" async></script> + {{ end }} + + {{/* Initialise code highlighting. */}} + {{ if $.Scratch.Get "highlight_enabled" }} + <script>hljs.initHighlightingOnLoad();</script> + {{ end }} + + {{ if ne site.Params.search.engine 0 }} + {{/* Configure search engine. */}} + <script> + const search_index_filename = {{ "/index.json" | relLangURL }}; + const i18n = { + 'placeholder': {{ i18n "search_placeholder" }}, + 'results': {{ i18n "search_results" }}, + 'no_results': {{ i18n "search_no_results" }} + }; + const content_type = { + 'post': {{ i18n "posts" }}, + 'project': {{ i18n "projects" }}, + 'publication' : {{ i18n "publications" }}, + 'talk' : {{ i18n "talks" }} + }; + </script> + {{ end }} + + {{/* Load hash anchors for documentation pages. */}} + {{ if eq .Type "docs" }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.anchor.url $js.anchor.version) $js.anchor.sri | safeHTML }} + <script> + anchors.add(); + </script> + {{ end }} + + {{ if eq site.Params.search.engine 1 }} + {{/* Fuse search result template. */}} + <script id="search-hit-fuse-template" type="text/x-template"> + <div class="search-hit" id="summary-{{"{{key}}"}}"> + <div class="search-hit-content"> + <div class="search-hit-name"> + {{ printf "<a href=\"%s\">%s</a>" "{{relpermalink}}" "{{title}}" | safeHTML }} + <div class="article-metadata search-hit-type">{{"{{type}}"}}</div> + <p class="search-hit-description">{{"{{snippet}}"}}</p> + </div> + </div> + </div> + </script> + {{ else if eq site.Params.search.engine 2 }} + {{/* Algolia search result template. */}} + <script id="search-hit-algolia-template" type="text/html"> + <div class="search-hit"> + <div class="search-hit-content"> + <div class="search-hit-name"> + {{ printf "<a href=\"%s\">{{{_highlightResult.title.value}}}</a>" "{{relpermalink}}" | safeHTML }} + </div> + <div class="article-metadata search-hit-type">{{"{{type}}"}}</div> + <p class="search-hit-description">{{ safeHTML "{{{_highlightResult.summary.value}}}" }}</p> + </div> + </div> + </script> + {{ end }} + + {{/* Fuse search engine. */}} + {{ if and (eq site.Params.search.engine 1) ($scr.Get "use_cdn") }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.fuse.url $js.fuse.version) $js.fuse.sri | safeHTML }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.mark.url $js.mark.version) $js.mark.sri | safeHTML }} + {{ end }} + + {{/* Algolia search engine. */}} + {{ if eq site.Params.search.engine 2 }} + {{ if ($scr.Get "use_cdn") }} + {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.instantsearch.url $js.instantsearch.version) $js.instantsearch.sri | safeHTML }} + {{ end }} + <script> + const algoliaConfig = { + appId: {{ site.Params.search.algolia.app_id }}, + apiKey: {{ site.Params.search.algolia.api_key }}, + indexName: {{ site.Params.search.algolia.index_name }}, + poweredBy: {{ site.Params.search.algolia.show_logo | default false }} + }; + </script> + {{ end }} + + {{ $js_comment := printf "/* Source Themes Academic v%s | https://sourcethemes.com/academic/ */\n" site.Data.academic.version }} + {{ $js_bundle_head := $js_comment | resources.FromString "js/bundle-head.js" }} + {{ $js_linebreak := "\n" | resources.FromString "js/linebreak.js" }}{{/* Fix no line break after Bootstrap JS causing error. */}} + {{ $js_academic := resources.Get "js/academic.js" }} + {{ $js_academic_search := resources.Get "js/academic-search.js" }} + {{ $js_algolia_search := resources.Get "js/algolia-search.js" }} + {{ $js_bootstrap := resources.Get "js/vendor/bootstrap.min.js" }} + {{ $js_bundle := slice $js_bootstrap $js_linebreak $js_academic }} + {{ if eq site.Params.search.engine 1 }} + {{ $js_bundle = $js_bundle | append $js_academic_search }} + {{ else if eq site.Params.search.engine 2 }} + {{ $js_bundle = $js_bundle | append $js_algolia_search }} + {{ end }} + {{ range site.Params.plugins_js }} + {{ $js_bundle = $js_bundle | append (resources.Get (printf "js/%s.js" .)) }} + {{ end }} + {{ $js_bundle := $js_bundle | resources.Concat "js/academic-bundle-pre.js" | minify }} + {{ $js_bundle := slice $js_bundle_head $js_bundle | resources.Concat "js/academic.min.js" | fingerprint "md5" }} + <script src="{{ $js_bundle.RelPermalink }}"></script> + + {{ partial "custom_js" . }} diff --git a/layouts/partials/slides.html b/layouts/partials/slides.html new file mode 100644 index 0000000..0cdfd9a --- /dev/null +++ b/layouts/partials/slides.html @@ -0,0 +1,25 @@ +<div class="reveal"> + <div class="slides"> + {{/* Loop over each page. */}} + {{ range . }} + {{ if ne (len .Content) 0 }} + + {{/* Must remove `<hr />` generated by Blackfriday footnotes as conflicts with slide delimiter. */}} + {{ $content := replace .Content "<div class=\"footnotes\">\n\n<hr />" "<div class=\"footnotes\">" }} + + {{/* Let `<hr />` delimit slides. */}} + {{ range (split $content "<hr />") }} + + {{/* Each `<section>` defines a new slide. */}} + {{/* Only begin new slide `<section>` if not already added by custom `slide` shortcode. */}} + {{ if not (in . "data-noprocess") }} + <section> + {{ end }} + {{ . | safeHTML }} + </section> + {{ end }} + + {{ end }} + {{ end }} + </div> +</div> diff --git a/layouts/partials/tags.html b/layouts/partials/tags.html new file mode 100644 index 0000000..721c119 --- /dev/null +++ b/layouts/partials/tags.html @@ -0,0 +1,8 @@ +{{ $taxonomy := "tags" }} +{{ with .Param $taxonomy }} +<div class="article-tags"> + {{ range $index, $value := . }} + <a class="badge badge-light" href="{{ (site.GetPage (printf "/%s/%s" $taxonomy (. | urlize))).RelPermalink }}">{{ . }}</a> + {{ end }} +</div> +{{ end }} diff --git a/layouts/partials/widget_page.html b/layouts/partials/widget_page.html new file mode 100644 index 0000000..809967f --- /dev/null +++ b/layouts/partials/widget_page.html @@ -0,0 +1,74 @@ +{{/* Notify JS that this is a widget page */}} +<span class="js-widget-page d-none"></span> + +{{/* Get widget page */}} +{{ $page := "" }} +{{ if .IsHome }} + {{ $page = "/home" }} +{{ else }} + {{ $page = .File.Path }} +{{ end }} +{{ $headless_bundle := site.GetPage $page }} +{{/* Check homepage exists */}} +{{ if not $headless_bundle }} + {{ errorf "Homepage not found or duplicate homepages detected for a localization! Add the `home/` folder (especially `/home/index.md`) to each language's content folder. For example, your site should have a `content/home/` folder containing `index.md` and your homepage sections, or for multi-language sites, `content/en/home/` and `content/zh/home/` etc. Refer to the 'Build Your Homepage' and 'Language' documentation at https://sourcethemes.com/academic/docs/ and the example homepage at https://github.com/gcushen/hugo-academic/tree/master/exampleSite/content/home/index.md ." }} +{{ end }} + +{{/* Load page sections */}} +{{ range $index, $st := where ( $headless_bundle.Resources.ByType "page" ) ".Params.active" "!=" false }} + {{/* Begin widget styling */}} + {{ $bg := $st.Params.design.background }} + {{ $style := "" }} + + {{ if $bg.color }} + {{ $style = printf "background-color: %s;" ($bg.color | default "transparent") }} + {{ end }} + + {{ if and $bg.gradient_start $bg.gradient_end }} + {{ $style = printf "%sbackground-image: linear-gradient(%s, %s);" $style $bg.gradient_start $bg.gradient_end }} + {{ end }} + + {{ if $bg.image }} + {{ $darken := "" }} + {{ if $bg.image_darken }} + {{ $darken = printf "linear-gradient(rgba(0, 0, 0, %s), rgba(0, 0, 0, %s))," (string $bg.image_darken) (string $bg.image_darken) }} + {{ end }} + {{/* See Hugo note on linking assets in styles: https://github.com/gohugoio/hugoThemes#common-permalink-issues */}} + {{ $style = printf "%sbackground-image: %s url('%s');" $style $darken (printf "img/%s" $bg.image | absURL) }} + {{ end }} + + {{ with $st.Params.design.spacing.padding }} + {{ $style_pad := printf "padding: %s;" (delimit . " ") }} + {{ $style = print $style $style_pad }} + {{ end }} + + {{ with $st.Params.advanced.css_style }} + {{ $style = print $style . }} + {{ end }} + + {{/* Fix Hugo's ContentBaseName returning wrong file base name when page section is within a bundle. */}} + {{ $hash_id := replace $st.File.ContentBaseName "index" (path.Base (path.Split .Path).Dir) }} + + {{ $widget := or $st.Params.widget "blank" }} + {{ if eq $widget "custom" }}{{ $widget = "blank" }}{{ end }}{{/* Support legacy Custom widget */}} + {{ if eq $widget "projects" }}{{ $widget = "portfolio" }}{{ end }}{{/* Support legacy Projects widget */}} + + {{ $widget_path := printf "widgets/%s.html" $widget }} + {{ $widget_args := dict "root" $ "page" $st "hash_id" $hash_id }} + {{ $css_classes := $st.Params.advanced.css_class | default "" }} + {{ $extra_attributes := "" }} + {{ $use_container := true }} + + {{/* Special case: Slider widget. */}} + {{ if in (slice "slider") $widget }} + {{ $css_classes = print $css_classes " carousel slide" }} + {{ $extra_attributes = printf "data-ride=\"carousel\" data-interval=\"%s\"" (string $st.Params.interval | default "5000") }} + {{ $use_container = false }} + {{ end }} + + <section id="{{$hash_id}}" class="home-section {{printf "wg-%s" (replace $widget "_" "-")}} {{if $bg.text_color_light}}dark{{end}} {{if $bg.image}}parallax{{end}} {{with $css_classes}}{{.}}{{end}}" {{with $style}}style="{{. | safeCSS}}"{{end}} {{print $extra_attributes | safeHTMLAttr}}> + {{if $use_container}}<div class="container">{{end}} + {{ partial $widget_path $widget_args }} + {{if $use_container}}</div>{{end}} + </section> +{{ end }} diff --git a/layouts/partials/widgets/about.html b/layouts/partials/widgets/about.html new file mode 100644 index 0000000..be6667b --- /dev/null +++ b/layouts/partials/widgets/about.html @@ -0,0 +1,113 @@ +{{ $ := .root }} +{{ $page := .page }} + +{{ $author := "" }} +{{ if .author }} +{{ $author = .author }} +{{ else }} +{{ $author = $page.Params.author }} +{{end}} + +{{ $person_page_path := (printf "/authors/%s" (urlize $author)) }} +{{ $person_page := site.GetPage $person_page_path }} +{{ if not $person_page }} +{{ errorf "Could not find an author page at `%s`. Please check the value of `author` in your About widget and create an associated author page if one does not already exist. See https://sourcethemes.com/academic/docs/page-builder/#about " $person_page_path }} +{{end}} +{{ $person := $person_page.Params }} + +<!-- About widget --> +<div class="row" itemprop="author" itemscope itemtype="http://schema.org/Person" + itemref="{{ if site.Params.email }}person-email{{ end }}{{ if site.Params.phone }} person-telephone{{ end }}{{ if site.Params.address}} person-address{{ end }}"> + <div class="col-lg-5"> + <div id="profile"> + {{ if site.Params.gravatar }} + <img class="portrait img-fluid" src="https://s.gravatar.com/avatar/{{ md5 $person.email }}?s=200')" + itemprop="image" alt="Avatar"> + {{ else }} + {{ $avatar_image := .page.Params.avatar_image }} + <img class="img-fluid" src="{{ printf "img/%s" $avatar_image | relURL }}" itemprop="image" alt="Avatar"> + {{ end }} + </div> + <ul class="network-icon bg-white mx-2 py-2 text-center" aria-hidden="true"> + {{ range $person.social }} + {{ $pack := or .icon_pack "fas" }} + {{ $pack_prefix := $pack }} + {{ if in (slice "fab" "fas" "far" "fal") $pack }} + {{ $pack_prefix = "fa" }} + {{ end }} + {{ $link := .link }} + {{ $scheme := (urls.Parse $link).Scheme }} + {{ $target := "" }} + {{ if not $scheme }} + {{ $link = .link | relLangURL }} + {{ else if in (slice "http" "https") $scheme }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + <li class="mx-3"> + <a itemprop="sameAs" href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }}> + <i class="{{ $pack }} {{ $pack_prefix }}-{{ .icon }}"></i> + </a> + </li> + {{ end }} + </ul> + </div> + <div class="col-lg-7" itemprop="description"> + + <div class="portrait-title"> + <h2 itemprop="name">{{ $person.name }}</h2> + {{ with $person.role }}<h3 class="d-inline-block" itemprop="jobTitle">{{ . | markdownify | emojify }},</h3>{{ end }} + + {{ range $person.organizations }} + <h3 class="d-inline-block" itemprop="worksFor" itemscope itemtype="http://schema.org/Organization"> + {{ with .url }}<a href="{{ . }}" target="_blank" itemprop="url" rel="noopener">{{ end }} + <span itemprop="name">{{ .name }}</span> + {{ if .url }}</a>{{ end }} + </h3> + {{ end }} + </div> + + <link itemprop="url" href="{{ .Permalink }}"> + + + + {{ $person_page.Content }} + + {{ range $person.btn }} + <a href="{{ .url }}" class="btn btn-primary btn-lg"><i class="fas fa-download mr-2" aria-hidden="true"></i>{{ .label }}</a> + {{ end }} + + + + <!-- <div class="row"> + + {{ with $person.education }} + <div class="col-md-7"> + <h3>{{ i18n "education" | markdownify }}</h3> + <ul class="ul-edu fa-ul"> + {{ range .courses }} + <li> + <i class="fa-li fas fa-graduation-cap"></i> + <div class="description"> + <p class="course">{{ .course }}{{ with .year }}, {{ . }}{{ end }}</p> + <p class="institution">{{ .institution }}</p> + </div> + </li> + {{ end }} + </ul> + </div> + {{ end }} + + {{ with $person.interests }} + <div class="col-md-5"> + <h3>{{ i18n "interests" | markdownify }}</h3> + <ul class="ul-interests"> + {{ range . }} + <li>{{ . | markdownify | emojify }}</li> + {{ end }} + </ul> + </div> + {{ end }} + + </div> --> + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/widgets/accomplishments.html b/layouts/partials/widgets/accomplishments.html new file mode 100644 index 0000000..db855a5 --- /dev/null +++ b/layouts/partials/widgets/accomplishments.html @@ -0,0 +1,49 @@ +{{ $ := .root }} +{{ $page := .page }} + +<!-- Accomplishments widget --> +<div class="row"> + <div class="col-12 text-center section-heading"> + <h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1> + {{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }} + {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }} + </div> + + {{ if $page.Params.item }} + {{ range $idx, $key := sort $page.Params.item ".date_start" "desc" }} + <div class="col-lg-6 col-md-6 mb-4"> + <div class="card experience course shadow-sm rounded-0 border-0"> + <div class="card-body"> + {{- with .url -}}<a href="{{.}}" target="_blank" rel="noopener">{{- end -}} + <h4 class="card-title exp-title text-muted my-0">{{.title | markdownify | emojify}}</h4> + {{- with .url -}}</a>{{- end -}} + + <div class="card-subtitle my-0 article-metadata"> + {{- with .organization_url}}<a href="{{.}}" target="_blank" rel="noopener">{{end -}} + {{- .organization | markdownify | emojify -}} + {{- with .organization_url}}</a>{{end -}} + + <span class="middot-divider"></span> + + {{ (time .date_start).Format ($page.Params.date_format | default "Jan 2006") }} + {{ if .date_end}} + – {{ (time .date_end).Format ($page.Params.date_format | default "Jan 2006") }} + {{end}} + </div> + + {{with .description}} + <div class="card-text">{{. | markdownify | emojify}}</div> + {{end}} + + {{ with .certificate_url }} + <a class="card-link" href="{{.}}" target="_blank" rel="noopener"> + {{ i18n "see_certificate" | default "See certificate" }} + </a> + {{ end }} + </div> + </div> + </div> + {{end}} + {{end}} +</div> +</div>
\ No newline at end of file diff --git a/layouts/partials/widgets/blank.html b/layouts/partials/widgets/blank.html new file mode 100644 index 0000000..1db1244 --- /dev/null +++ b/layouts/partials/widgets/blank.html @@ -0,0 +1,20 @@ +{{ $st := .page }} +{{ $columns := $st.Params.design.columns | default "2" }} + +<div class="row"> + {{ if ne $columns "1" }} + <div class="col-12 section-heading text-center"> + {{ with $st.Title }}<h1>{{ . | markdownify | emojify }}</h1>{{ end }} + {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }} + </div> + <div class="col-12"> + {{ $st.Content }} + </div> + {{ else }} + <div class="col-12"> + {{ with $st.Title }}<h1>{{ . | markdownify | emojify }}</h1>{{ end }} + {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }} + {{ $st.Content }} + </div> + {{ end }} +</div> diff --git a/layouts/partials/widgets/contact.html b/layouts/partials/widgets/contact.html new file mode 100644 index 0000000..a660767 --- /dev/null +++ b/layouts/partials/widgets/contact.html @@ -0,0 +1,109 @@ +{{ $ := .root }} +{{ $page := .page }} +{{ $autolink := default true $page.Params.autolink }} + +<!-- Contact widget --> +<div class="row contact-widget"> + <div class="col-12 text-center section-heading"> + <h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1> + {{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }} + </div> + <div class="col-12"> + {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }} + </div> + <div class="col-md-6"> + {{ if $page.Params.email_form }} + + {{ $post_action := "" }} + {{ if eq $page.Params.email_form 1 }} + {{ $post_action = "netlify" }} + {{ else }} + {{ if not site.Params.email }} + {{ errorf "Please set an email address for the contact form using the `email` parameter in `config.toml`. Otherwise, set `email_form = 0` to disable the contact form." }} + {{ end }} + {{ $post_action = printf "action=\"https://formspree.io/%s\"" site.Params.email }} + {{end}} + + <div class="mb-3"> + <form name="contact" method="POST" {{ $post_action | safeHTMLAttr }}> + <div class="form-group form-inline"> + <label class="sr-only" for="inputName">{{ i18n "contact_name" }}</label> + <input type="text" name="name" class="form-control rounded-0 w-100" id="inputName" + placeholder="{{ i18n "contact_name" | default "Name" }}" required> + </div> + <div class="form-group form-inline"> + <label class="sr-only" for="inputEmail">{{ i18n "contact_email" }}</label> + <input type="email" name="email" class="form-control rounded-0 w-100" id="inputEmail" + placeholder="{{ i18n "contact_email" | default "Email" }}" required> + </div> + <div class="form-group"> + <label class="sr-only" for="inputMessage">{{ i18n "contact_message" }}</label> + <textarea name="message" class="form-control rounded-0" id="inputMessage" rows="5" + placeholder="{{ i18n "contact_message" | default "Message" }}" required></textarea> + </div> + <button type="submit" + class="btn btn-outline-primary px-3 py-2">{{ i18n "contact_send" | default "Send" }}</button> + </form> + </div> + {{end}} + + </div> + <div class="col-md-6"> + <ul class="fa-ul" itemscope> + {{ if and site.Params.email (not $page.Params.email_form) }} + <li> + <i class="fa-li fas fa-envelope mt-2" aria-hidden="true"></i> + <span id="person-email" itemprop="email"> + {{- if $autolink }}<a + href="mailto:{{ site.Params.email }}">{{ site.Params.email }}</a>{{ else }}{{ site.Params.email }}{{ end -}} + </span> + </li> + {{ end }} + + {{ with site.Params.phone }} + <li> + <i class="fa-li fas fa-phone mt-2" aria-hidden="true"></i> + <span id="person-telephone" itemprop="telephone"> + {{- if $autolink }}<a href="tel:{{ . }}">{{ . }}</a>{{ else }}{{ . }}{{ end -}} + </span> + </li> + {{ end }} + + {{ with site.Params.address }} + <li> + <i class="fa-li fas fa-map-marker-alt mt-2" aria-hidden="true"></i> + <span id="person-address" itemprop="address">{{ . | markdownify | emojify }}</span> + </li> + {{ end }} + + {{ with site.Params.office_hours }} + <li> + <i class="fa-li fas fa-clock mt-2" aria-hidden="true"></i> + <span>{{ . | markdownify | emojify }}</span> + </li> + {{ end }} + + {{ with site.Params.appointment_url }} + <li> + <i class="fa-li fas fa-calendar-check mt-2" aria-hidden="true"></i> + <a href="{{ . }}" target="_blank" + rel="noopener">{{ i18n "book_appointment" | default "Book an appointment" }}</a> + </li> + {{ end }} + + </ul> + </div> + <div class="col-12"> + {{ if site.Params.map }} + <div class="d-none"> + <input id="map-provider" value="{{ site.Params.map }}"> + <input id="map-lat" value="{{ site.Params.latitude }}"> + <input id="map-lng" value="{{ site.Params.longitude }}"> + <input id="map-dir" value="{{ site.Params.address }}"> + <input id="map-zoom" value="{{ site.Params.zoom | default "15" }}"> + <input id="map-api-key" value="{{ site.Params.map_api_key }}"> + </div> + <div id="map"></div> + {{ end }} + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/widgets/experience.html b/layouts/partials/widgets/experience.html new file mode 100644 index 0000000..1646168 --- /dev/null +++ b/layouts/partials/widgets/experience.html @@ -0,0 +1,40 @@ +{{ $ := .root }} +{{ $page := .page }} + +<div class="row"> + <!-- Experience widget --> + <div class="col-12 text-center section-heading"> + <h1>{{ with $page.Title }}{{ . | markdownify }}{{ end }}</h1> + {{ with $page.Params.subtitle }}<p>{{ . | markdownify }}</p>{{ end }} + {{ with $page.Content }}<p>{{ . | markdownify }}</p>{{ end }} + </div> + {{ if $page.Params.experience }} + {{ $exp_len := len $page.Params.experience }} + {{ range $idx, $key := sort $page.Params.experience ".date_start" "desc" }} + <div class="col-md-6 col-lg-4 mb-4"> + <div class="card rounded-0 border-0 shadow-sm experience"> + <div class="card-body rounded-0 border-0"> + <h4 class="card-title exp-company my-0"> + {{- with .company_url}}<a href="{{.}}" target="_blank" + rel="noopener">{{end}}{{.company | markdownify | emojify}}{{with .company_url}}</a>{{end -}} + </h4> + <p class="card-title text-muted exp-title my-0">{{.title | markdownify | emojify}}</p> + <div class="text-muted exp-meta"> + {{ (time .date_start).Format ($page.Params.date_format | default "January 2006") }} – + {{ if .date_end}} + {{ (time .date_end).Format ($page.Params.date_format | default "January 2006") }} + {{else}} + {{ i18n "present" | default "Present" }} + {{end}} + {{with .location}} + <span class="middot-divider"></span> + <span>{{.}}</span> + {{end}} + </div> + {{with .description}}<div class="card-text">{{. | markdownify | emojify}}</div>{{end}} + </div> + </div> + </div> + {{end}} + {{end}} +</div>
\ No newline at end of file diff --git a/layouts/partials/widgets/featured.html b/layouts/partials/widgets/featured.html new file mode 100644 index 0000000..09e8584 --- /dev/null +++ b/layouts/partials/widgets/featured.html @@ -0,0 +1,60 @@ +{{/* Featured Content Widget */}} + +{{/* Initialise */}} +{{ $ := .root }} +{{ $st := .page }} +{{ $items_type := $st.Params.content.page_type | default "post" }} +{{ $items_count := $st.Params.content.count | default 65535 }} +{{ $items_sort := $st.Params.content.order| default "desc" }} + +{{/* Query */}} +{{ $query := where (where site.RegularPages "Type" $items_type) "Params.featured" true }} + +{{/* Filters */}} +{{ if $st.Params.content.filters.tag }} + {{ $archive_page := site.GetPage (printf "tags/%s" $st.Params.content.filters.tag) }} + {{ $query = $query | intersect $archive_page.Pages }} +{{ end }} +{{ if $st.Params.content.filters.category }} + {{ $archive_page := site.GetPage (printf "categories/%s" $st.Params.content.filters.category) }} + {{ $query = $query | intersect $archive_page.Pages }} +{{ end }} +{{ if $st.Params.content.filters.publication_type }} + {{ $archive_page := site.GetPage (printf "publication_types/%s" $st.Params.content.filters.publication_type) }} + {{ $query = $query | intersect $archive_page.Pages }} +{{ end }} + +{{/* Sort */}} +{{ $sort_by := "Date" }} +{{ $query = sort $query $sort_by $items_sort }} + +{{/* Limit */}} +{{ $query = first $items_count $query }} + +<div class="row"> + <div class="col-12 section-heading text-center"> + <h1>{{ with $st.Title }}{{ . | markdownify | emojify }}{{ end }}</h1> + {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }} + </div> + <div class="col-12"> + <div class="row justify-content-center"> + + {{ with $st.Content }}<p>{{ . }}</p>{{ end }} + + {{ range $post := $query }} + {{ if eq $st.Params.design.view 1 }} + {{ partial "li_list" . }} + {{ else if eq $st.Params.design.view 3 }} + <div class="col-lg-4 col-md-6 mb-4"> + {{ partial "li_card" . }} + </div> + {{ else if eq $st.Params.design.view 4 | and (eq $items_type "publication") }} + {{ partial "li_citation" . }} + {{ else }} + {{ partial "li_compact" . }} + {{ end }} + {{end}} + + </div> + </div> +</div> diff --git a/layouts/partials/widgets/featurette.html b/layouts/partials/widgets/featurette.html new file mode 100644 index 0000000..20e1003 --- /dev/null +++ b/layouts/partials/widgets/featurette.html @@ -0,0 +1,33 @@ +{{ $ := .root }} +{{ $page := .page }} + +<div class="row featurette"> + {{ with $page.Title }} + <div class="col-12 section-heading"> + <h1>{{ . | markdownify | emojify }}</h1> + {{ if $page.Params.subtitle }}<p>{{ $page.Params.subtitle | markdownify | emojify }}</p>{{ end }} + </div> + {{ end }} + + {{ with $page.Content }} + <div class="col-12"> + {{ . | markdownify }} + </div> + {{ end }} + + {{ range $page.Params.feature }} + {{ $pack := or .icon_pack "fas" }} + {{ $pack_prefix := $pack }} + {{ if in (slice "fab" "fas" "far" "fal") $pack }} + {{ $pack_prefix = "fa" }} + {{ end }} + <div class="col-lg-3 col-sm-6 mb-4 mb-lg-0"> + <div class="position-relative py-2 shadow"> + <div class="progress-bar" style="width:{{ .parcent }}"></div> + {{ with .icon }}<div class="featurette-icon"><i class="{{ $pack }} {{ $pack_prefix }}-{{ . }}"></i></div>{{ end }} + <h3>{{ .name | markdownify | emojify }}</h3> + {{ with .parcent }}<p>{{ . }}</p>{{ end }} + </div> + </div> + {{ end }} +</div>
\ No newline at end of file diff --git a/layouts/partials/widgets/hero.html b/layouts/partials/widgets/hero.html new file mode 100644 index 0000000..79cb091 --- /dev/null +++ b/layouts/partials/widgets/hero.html @@ -0,0 +1,54 @@ +{{ $ := .root }} +{{ $page := .page }} +{{ $bg := $page.Params.design.background }} + +{{ if $page.Params.hero_media }} +<div class="row"> + <div class="col-md-6 order-md-1 text-center text-md-left align-self-center"> +{{ end }} + + {{ with $page.Content }} + <div>{{ . }}</div> + {{ end }} + + {{/* Call-to-action link */}} + {{ if $page.Params.btn.url }} + {{ $pack := or $page.Params.btn.icon_pack "fas" }} + {{ $pack_prefix := $pack }} + {{ if in (slice "fab" "fas" "far" "fal") $pack }} + {{ $pack_prefix = "fa" }} + {{ end }} + {{ $link := $page.Params.btn.url }} + {{ $scheme := (urls.Parse $link).Scheme }} + {{ $target := "" }} + {{ if not $scheme }} + {{ $link = $link | relLangURL }} + {{ else if in (slice "http" "https") $scheme }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + <p class="mt-4"> + <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="btn {{if $bg.text_color_light}}btn-light{{else}}btn-primary{{end}} btn-lg page-scroll">{{ if $page.Params.btn.icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ $page.Params.btn.icon }} mr-2" aria-hidden="true"></i>{{end}}{{ $page.Params.btn.label | markdownify | emojify | safeHTML }}</a> + + {{/* Alternative Call-to-action link */}} + {{ if $page.Params.btn_alt.url }} + {{ $link := $page.Params.btn_alt.url }} + {{ $scheme := (urls.Parse $link).Scheme }} + {{ $target := "" }} + {{ if not $scheme }} + {{ $link = $link | relLangURL }} + {{ else if in (slice "http" "https") $scheme }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + <a href="{{ $link | safeURL }}" {{ $target | safeHTMLAttr }} class="btn btn-lg {{if $bg.text_color_light}}btn-outline-light{{else}}btn-outline-primary{{end}} page-scroll">{{ if $page.Params.btn_alt.icon }}<i class="{{ $pack }} {{ $pack_prefix }}-{{ $page.Params.btn_alt.icon }} mr-2" aria-hidden="true"></i>{{end}}{{ $page.Params.btn_alt.label | markdownify | emojify | safeHTML }}</a> + {{ end }} + </p> + {{ end }} + + {{/* Hero image */}} + {{ if $page.Params.hero_media }} + </div> + <div class="col-6 mx-auto col-md-6 order-md-2 hero-media"> + <img class="hero-img img-fluid" src="{{ printf "img/%s" $page.Params.hero_media | relURL }}" alt=""> + </div> +</div> +{{ end }}
\ No newline at end of file diff --git a/layouts/partials/widgets/pages.html b/layouts/partials/widgets/pages.html new file mode 100644 index 0000000..aaaf2a8 --- /dev/null +++ b/layouts/partials/widgets/pages.html @@ -0,0 +1,101 @@ +{{/* Pages Widget */}} + +{{/* Initialise */}} +{{ $ := .root }} +{{ $st := .page }} +{{ $items_type := $st.Params.content.page_type | default "post" }} +{{ $items_offset := $st.Params.content.offset | default 0 }} +{{ $items_count := $st.Params.content.count }} +{{ if eq $items_count 0 }} +{{ $items_count = 65535 }} +{{ else }} +{{ $items_count = $items_count | default 5 }} +{{ end }} +{{ $items_sort := $st.Params.content.order | default "desc" }} + +{{/* Query */}} +{{ $query := where site.RegularPages "Type" $items_type }} +{{ $archive_page := site.GetPage "Section" $items_type }} + +{{/* Filters */}} +{{ if $st.Params.content.filters.tag }} +{{ $archive_page = site.GetPage (printf "tags/%s" $st.Params.content.filters.tag) }} +{{ $query = $query | intersect $archive_page.Pages }} +{{ end }} +{{ if $st.Params.content.filters.category }} +{{ $archive_page = site.GetPage (printf "categories/%s" $st.Params.content.filters.category) }} +{{ $query = $query | intersect $archive_page.Pages }} +{{ end }} +{{ if $st.Params.content.filters.publication_type }} +{{ $archive_page = site.GetPage (printf "publication_types/%s" $st.Params.content.filters.publication_type) }} +{{ $query = $query | intersect $archive_page.Pages }} +{{ end }} +{{ if $st.Params.content.filters.exclude_featured }} +{{ $query = where $query "Params.featured" "!=" true }} +{{ end }} +{{ if $st.Params.content.filters.exclude_past }} +{{ $query = where $query "Date" ">=" now }} +{{ end }} +{{ if $st.Params.content.filters.exclude_future }} +{{ $query = where $query "Date" "<" now }} +{{ end }} + +{{ $count := len $query }} + +{{/* Sort */}} +{{ $sort_by := "Date" }} +{{ $query = sort $query $sort_by $items_sort }} + +{{/* Offset and Limit */}} +{{ if gt $items_offset 0 }} +{{ $query = first $items_count (after $items_offset $query) }} +{{ else }} +{{ $query = first $items_count $query }} +{{ end }} + +{{/* Localisation */}} +{{ $i18n := "" }} +{{ if eq $items_type "post" }} +{{ $i18n = "more_posts" }} +{{ else if eq $items_type "talk" }} +{{ $i18n = "more_talks" }} +{{ else if eq $items_type "publication" }} +{{ $i18n = "more_publications" }} +{{ else }} +{{ $i18n = "more_pages" }} +{{ end }} + +<div class="row"> + <div class="col-12 section-heading text-center"> + <h1>{{ with $st.Title }}{{ . | markdownify | emojify }}{{ end }}</h1> + {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }} + {{ with $st.Content }}<p>{{ . }}</p>{{ end }} + </div> + <div class="col-12"> + <div class="row justify-content-center"> + {{ range $post := $query }} + {{ if eq $st.Params.design.view 1 }} + {{ partial "li_list" . }} + {{ else if eq $st.Params.design.view 3 }} + <div class="col-lg-4 col-md-6 mb-4"> + {{ partial "li_card" . }} + </div> + {{ else if eq $st.Params.design.view 4 | and (eq $items_type "publication") }} + {{ partial "li_citation" . }} + {{ else }} + {{ partial "li_compact" . }} + {{ end }} + {{end}} + + {{ if gt $count $items_count }} + <div class="see-all"> + <a href="{{ $archive_page.RelPermalink }}"> + {{ i18n $i18n | default "See all" }} + <i class="fas fa-angle-right"></i> + </a> + </div> + {{ end }} + + </div> + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/widgets/people.html b/layouts/partials/widgets/people.html new file mode 100644 index 0000000..be3fdea --- /dev/null +++ b/layouts/partials/widgets/people.html @@ -0,0 +1,53 @@ +{{ $ := .root }} +{{ $page := .page }} + +<div class="row justify-content-center people-widget"> + {{ with $page.Title }} + <div class="col-md-12 section-heading"> + <h1>{{ . | markdownify | emojify }}</h1> + {{ if $page.Params.subtitle }}<p>{{ $page.Params.subtitle | markdownify | emojify }}</p>{{ end }} + </div> + {{ end }} + + {{ with $page.Content }} + <div class="col-md-12"> + <p>{{ . }}</p> + </div> + {{ end }} + + {{ range $page.Params.user_groups }} + <div class="col-md-12"> + <h2 class="mb-4">{{ . | markdownify }}</h2> + </div> + + {{ $query := where (where site.Pages "Section" "authors") ".Params.user_groups" "intersect" (slice .) }} + {{ range $query }} + + {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }} + {{/* Get link to user's profile page. */}} + {{ $link := "" }} + {{ with site.GetPage (printf "/authors/%s" (path.Base (path.Split .Path).Dir)) }} + {{ $link = .RelPermalink }} + {{ end }} + <div class="col-12 col-sm-auto people-person"> + {{ $src := "" }} + {{ if site.Params.gravatar }} + {{ $src = printf "https://s.gravatar.com/avatar/%s?s=200" (md5 .Params.email) }} + {{ else if $avatar }} + {{ $avatar_image := $avatar.Fill "150x150 Center" }} + {{ $src = $avatar_image.RelPermalink }} + {{ end }} + {{ if $src }} + {{with $link}}<a href="{{.}}">{{end}}<img class="portrait" src="{{ $src }}" alt="Avatar">{{if $link}}</a>{{end}} + {{ end }} + + <div class="portrait-title"> + <h2>{{with $link}}<a href="{{.}}">{{end}}{{ .Params.name }}{{if $link}}</a>{{end}}</h2> + {{ with .Params.role }}<h3>{{ . | markdownify | emojify }}</h3>{{ end }} + {{ with .Params.interests }}<p class="people-interests">{{ delimit . ", " | markdownify | emojify }}</p>{{ end }} + </div> + </div> + + {{ end }} + {{ end }} +</div> diff --git a/layouts/partials/widgets/portfolio.html b/layouts/partials/widgets/portfolio.html new file mode 100644 index 0000000..c32a989 --- /dev/null +++ b/layouts/partials/widgets/portfolio.html @@ -0,0 +1,86 @@ +{{/* Portfolio Widget */}} + +{{/* Initialise */}} +{{ $ := .root }} +{{ $st := .page }} +{{ $items_type := $st.Params.content.page_type | default "project" }} +{{ $columns := $st.Params.design.columns | default "2" }} + +{{ if ne $columns "1" }} +{{/* Standard dual-column layout. */}} + +<div class="row"> + <div class="col-12 text-center section-heading"> + + {{ with $st.Title }}<h1>{{ . | markdownify | emojify }}</h1>{{ end }} + {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }} + + </div> + <div class="col-12"> + + {{ else }} + {{/* Single column layout. */}} + + <div class="center-text"> + {{ with $st.Title }}<h1 class="mt-0">{{ . | markdownify | emojify }}</h1>{{ end }} + {{ with $st.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }} + </div> + <div> + {{ end }} + + {{ with $st.Content }}<p>{{ . }}</p>{{ end }} + + {{ if $st.Params.content.filter_button }} + + {{ $filter_default := default (int $st.Params.content.filter_default) 0 }} + + {{/* Parse default filter tag from front matter in the form of either tag name or CSS class name. */}} + {{ $default_filter_tag_raw := (index $st.Params.content.filter_button ($filter_default)).tag }} + {{ $default_filter_tag := printf ".js-id-%s" (replace $default_filter_tag_raw " " "-") }} + {{ if or (eq (substr $default_filter_tag_raw 0 1) "*") (eq (substr $default_filter_tag_raw 0 1) ".") }} + {{ $default_filter_tag = $default_filter_tag_raw }} + {{ end }} + + <span class="d-none default-project-filter">{{ $default_filter_tag }}</span> + + {{/* Only show filter buttons if there are multiple filters. */}} + {{ if gt (len $st.Params.content.filter_button) 1 }} + <div class="project-toolbar"> + <div class="project-filters"> + <ul class="list-inline text-center"> + <li class="list-inline-item">{{ range $idx, $item := $st.Params.content.filter_button }} + {{/* Parse filter tag from front matter in the form of either tag name or CSS class name. */}} + {{ $data_filter := printf ".js-id-%s" (replace .tag " " "-") }} + {{ if or (eq (substr .tag 0 1) "*") (eq (substr .tag 0 1) ".") }} + {{ $data_filter = .tag }} + {{ end }} + <a href="#" data-filter="{{ $data_filter | safeHTMLAttr }}" + class="btn btn-primary btn-lg{{ if eq $idx $filter_default }} active{{ end }}">{{ .name }}</a> + {{ end }} + </li> + </ul> + </div> + </div> + {{ end }} + {{ end }} + + <div class="{{ if or $st.Params.content.filter_button (eq $st.Params.design.view 3) }}isotope projects-container{{end}} {{if eq $st.Params.design.view 3}}js-layout-masonry{{else}}row js-layout-row{{end}} {{ if eq $st.Params.design.view 5 }}project-showcase mt-5{{end}}"> + {{ range $idx, $item := where site.RegularPages "Type" $items_type }} + {{ $link := $item.RelPermalink }} + {{ $target := "" }} + {{ if $item.Params.external_link }} + {{ $link = $item.Params.external_link }} + {{ $target = "target=\"_blank\" rel=\"noopener\"" }} + {{ end }} + {{ if eq $st.Params.design.view 1 }} + {{ partial "project_li_list" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }} + {{ else if eq $st.Params.design.view 3 }} + {{ partial "project_li_card" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }} + {{ else }} + {{ partial "project_li_showcase" (dict "widget" $st "index" $idx "item" $item "link" $link "target" $target) }} + {{ end }} + {{ end }} + </div> + </div> + </div> +</div>
\ No newline at end of file diff --git a/layouts/partials/widgets/slider.html b/layouts/partials/widgets/slider.html new file mode 100644 index 0000000..a8339af --- /dev/null +++ b/layouts/partials/widgets/slider.html @@ -0,0 +1,58 @@ +{{ $ := .root }} +{{ $page := .page }} +{{ $hash_id := .hash_id }} + +<!-- Indicators --> +<ol class="carousel-indicators"> + {{ range $index, $item := $page.Params.item }} + <li data-target="#{{$hash_id}}" data-slide-to="{{$index}}" {{if eq $index 0}}class="active"{{end}}></li> + {{ end }} +</ol> + +<!-- Carousel slides wrapper --> +<div class="carousel-inner"> + {{ range $index, $item := $page.Params.item }} + <div class="wg-hero dark carousel-item{{if eq $index 0}} active{{end}}" style="{{with $page.Params.height}}{{printf "height: %s;" . | safeCSS}}{{end}} + {{ if $item.overlay_color }} + background-color: {{ $item.overlay_color | default "transparent" }}; + {{ end }} + {{ if $item.overlay_img }} + background-image: + {{ if $item.overlay_filter }}linear-gradient(rgba(0, 0, 0, {{ $item.overlay_filter }}), rgba(0, 0, 0, {{ $item.overlay_filter }})), {{ end }} + url('{{ printf "img/%s" $item.overlay_img | absURL }}'); + {{ end }} + ;"> + <div class="container" style="text-align: {{$item.align | default "left"}};"> + <h1 class="hero-title" itemprop="headline"> + {{ with $item.title }}{{ . | markdownify | emojify }}{{ end }} + </h1> + + {{ with $item.content }} + <p class="hero-lead" style="{{if eq $item.align "center"}}margin: 0 auto 0 auto;{{else if eq $item.align "right"}}margin-left: auto; margin-right: 0{{end}}"> + {{ . | markdownify | emojify }} + </p> + {{ end }} + + {{ if $item.cta_url }} + {{ $pack := or .icon_pack "fa" }} + <p> + <a href="{{ $item.cta_url }}" class="btn btn-light btn-lg"> + {{- with $item.cta_icon -}}<i class="{{ $pack }} {{ $pack }}-{{ . }}" style="padding-right: 10px;"></i>{{- end -}} + {{- $item.cta_label | emojify | safeHTML -}} + </a> + </p> + {{ end }} + </div> + </div> + {{ end }} +</div> + +<!-- Left and right controls --> +<a class="carousel-control-prev" href="#{{$hash_id}}" data-slide="prev"> + <span class="carousel-control-prev-icon"></span> + <span class="sr-only">Previous</span> +</a> +<a class="carousel-control-next" href="#{{$hash_id}}" data-slide="next"> + <span class="carousel-control-next-icon"></span> + <span class="sr-only">Next</span> +</a> diff --git a/layouts/partials/widgets/tag_cloud.html b/layouts/partials/widgets/tag_cloud.html new file mode 100644 index 0000000..84291af --- /dev/null +++ b/layouts/partials/widgets/tag_cloud.html @@ -0,0 +1,24 @@ +{{ $ := .root }} +{{ $page := .page }} +<div class="row"> + <div class="col-12 text-center section-heading"> + <h1>{{ with $page.Title }}{{ . | markdownify | emojify }}{{ end }}</h1> + {{ with $page.Params.subtitle }}<p>{{ . | markdownify | emojify }}</p>{{ end }} + </div> + <div class="col-12"> + {{ with $page.Content }}<p>{{ . }}</p>{{ end }} + + {{ if not (eq (len site.Taxonomies.tags) 0) }} + {{ $min := len (index site.Taxonomies.tags.ByCount.Reverse 0).Pages }} + {{ $max := add (len (index site.Taxonomies.tags.ByCount 0).Pages) 1 }} + + <div class="text-center"> + {{ range $name, $taxonomy := site.Taxonomies.tags }} + {{ $tagCount := len $taxonomy.Pages }} + {{ $weight := div (sub (math.Log $tagCount) (math.Log $min)) (sub (math.Log $max) (math.Log $min)) }} + <a class="btn btn-outline-dark btn-lg" href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a> + {{ end }} + </div> + {{ end }} + </div> +</div>
\ No newline at end of file diff --git a/layouts/project/single.html b/layouts/project/single.html new file mode 100644 index 0000000..a89a431 --- /dev/null +++ b/layouts/project/single.html @@ -0,0 +1,78 @@ +{{- define "main" -}} + +<article class="article article-project py-5" itemscope itemtype="http://schema.org/Article"> + + {{ partial "page_header.html" . }} + + <div class="article-container"> + + <div class="article-style" itemprop="articleBody"> + {{ .Content }} + </div> + + {{ partial "tags.html" . }} + {{ partial "page_author.html" . }} + + {{ $page := . }} + {{ $project := .File.ContentBaseName }} + + {{ $items := where (where site.RegularPages "Type" "post") ".Params.projects" "intersect" (slice $project) }} + {{ $count := len $items }} + {{ if ge $count 1 }} + <h2>{{ (i18n "posts") }}</h2> + {{ range $items }} + {{ if eq site.Params.projects.post_view 1 }} + {{ partial "li_list" . }} + {{ else if eq site.Params.projects.post_view 3 }} + {{ partial "li_card" . }} + {{ else }} + {{ partial "li_compact" . }} + {{ end }} + {{ end }} + {{ end }} + + {{ $items := where (where site.RegularPages "Type" "publication") ".Params.projects" "intersect" (slice $project) }} + {{ $pubs_len := len $items }} + {{ if ge $pubs_len 1 }} + <h2>{{ (i18n "publications") }}</h2> + <div class="row justify-content-center"> + {{ range $items }} + {{ if eq site.Params.projects.publication_view 1 }} + {{ partial "li_list" . }} + {{ else if eq site.Params.projects.publication_view 3 }} + {{ partial "li_card" . }} + {{ else if eq site.Params.projects.publication_view 4 }} + {{ partial "li_citation" . }} + {{ else }} + {{ partial "li_compact" . }} + {{ end }} + {{ end }} + {{ end }} + </div> + + {{ $items := where (where site.RegularPages "Type" "talk") ".Params.projects" "intersect" (slice $project) }} + {{ $talks_len := len $items }} + {{ if ge $talks_len 1 }} + <h2>{{ (i18n "talks") }}</h2> + <div class="row justify-content-center"> + {{ range $items }} + {{ if eq site.Params.projects.talk_view 1 }} + {{ partial "li_list" . }} + {{ else if eq site.Params.projects.talk_view 3 }} + {{ partial "li_card" . }} + {{ else }} + {{ partial "li_compact" . }} + {{ end }} + {{ end }} + {{ end }} + </div> + </div> +</article> + +{{ if site.Params.section_pager }} +<div class="article-container article-widget"> + {{ partial "section_pager.html" . }} +</div> +{{ end }} + +{{- end -}}
\ No newline at end of file diff --git a/layouts/publication/single.html b/layouts/publication/single.html new file mode 100644 index 0000000..b155051 --- /dev/null +++ b/layouts/publication/single.html @@ -0,0 +1,65 @@ +{{- define "main" -}} + +<div class="pub" itemscope itemtype="http://schema.org/CreativeWork"> + + {{ partial "page_header.html" . }} + + <div class="article-container"> + + {{ if .Params.abstract }} + <h3>{{ i18n "abstract" }}</h3> + <p class="pub-abstract" itemprop="text">{{ .Params.abstract | markdownify }}</p> + {{ end }} + + {{ if (.Params.publication_types) and (ne (index .Params.publication_types 0) "0") }} + <div class="row"> + <div class="col-md-1"></div> + <div class="col-md-10"> + <div class="row"> + <div class="col-12 col-md-3 pub-row-heading">{{ i18n "publication_type" }}</div> + <div class="col-12 col-md-9"> + {{ $pub_types := partial "functions/get_pub_types" $ }} + {{ range $index, $pubtype := .Params.publication_types }} + <a href="{{ (site.GetPage "section" "publication").RelPermalink }}#{{ . | urlize }}"> + {{ index $pub_types (int .) }} + </a> + {{ end }} + </div> + </div> + </div> + <div class="col-md-1"></div> + </div> + <div class="d-md-none space-below"></div> + {{ end }} + + {{ if .Params.publication }} + <div class="row"> + <div class="col-md-1"></div> + <div class="col-md-10"> + <div class="row"> + <div class="col-12 col-md-3 pub-row-heading">{{ i18n "publication" }}</div> + <div class="col-12 col-md-9">{{ .Params.publication | markdownify }}</div> + </div> + </div> + <div class="col-md-1"></div> + </div> + <div class="d-md-none space-below"></div> + {{ end }} + + <div class="space-below"></div> + + <div class="article-style">{{ .Content }}</div> + + {{ partial "tags.html" . }} + {{ partial "page_author.html" . }} + + </div> +</div> + +{{ if site.Params.section_pager }} +<div class="article-container article-widget"> + {{ partial "section_pager.html" . }} +</div> +{{ end }} + +{{- end -}} diff --git a/layouts/section/docs.html b/layouts/section/docs.html new file mode 100644 index 0000000..b11c6d0 --- /dev/null +++ b/layouts/section/docs.html @@ -0,0 +1,18 @@ +{{- define "main" -}} + +{{ partial "page_header.html" . }} + +<div class="universal-wrapper"> + {{ with .Content }} + <div class="article-style" itemprop="articleBody">{{ . }}</div> + {{ end }} + <ul class="list-unstyled"> + {{ if gt (len .Sections) 0}} + {{ range .Sections }} + <li class="p-4 shadow-sm mb-4 card rounded-0"><h5><a class="stretched-link" href="{{.RelPermalink}}">{{.LinkTitle}}</a></h5> {{with .Params.summary}}<p>{{. | plainify | emojify}}</p>{{end}}</li> + {{end}} + {{end}} + </ul> +</div> + +{{- end -}}
\ No newline at end of file diff --git a/layouts/section/post.html b/layouts/section/post.html new file mode 100644 index 0000000..19ecbbb --- /dev/null +++ b/layouts/section/post.html @@ -0,0 +1,28 @@ +{{- define "main" -}} + +{{ partial "page_header.html" . }} + +<div class="universal-wrapper"> + + {{ with .Content }} + <div class="article-style" itemprop="articleBody">{{ . }}</div> + {{ end }} + + {{ $paginator := .Paginate .Data.Pages }} + {{ range $paginator.Pages }} + {{ if eq $.Params.view 1 }} + {{ partial "li_list" . }} + {{ else if eq $.Params.view 3 }} + <div class="col-lg-4 col-md-6 mb-4"> + {{ partial "li_card" . }} + </div> + {{ else }} + {{ partial "li_compact" . }} + {{ end }} + {{ end }} + + {{ partial "pagination" . }} + +</div> + +{{- end -}} diff --git a/layouts/section/publication.html b/layouts/section/publication.html new file mode 100644 index 0000000..d6b3fb7 --- /dev/null +++ b/layouts/section/publication.html @@ -0,0 +1,78 @@ +{{- define "main" -}} + +{{ partial "page_header.html" . }} + +<div class="universal-wrapper"> + <div class="row"> + <div class="col-lg-12"> + + {{ with .Content }} + <div class="article-style" itemprop="articleBody">{{ . }}</div> + {{ end }} + + {{/* Array of distinct years. */}} + {{ range .Pages.ByDate.Reverse }} + {{ $year := print (.Date.Format "2006") }} + {{ $.Scratch.SetInMap "years" $year $year }} + {{ end }} + + <div class="form-row mb-4"> + <div class="col-auto"> + <input type="search" class="filter-search" placeholder="{{ i18n "search_placeholder" }}" autocapitalize="off" + autocomplete="off" autocorrect="off" role="textbox" spellcheck="false"> + </div> + <div class="col-auto"> + <select class="pub-filters pubtype-select form-control form-control-sm" data-filter-group="pubtype"> + <option value="*">{{ i18n "publication_type" }}</option> + {{ $pub_types := partial "functions/get_pub_types" $ }} + {{ range $index, $taxonomy := site.Taxonomies.publication_types }} + <option value=".pubtype-{{ (int $index) }}"> + {{ index $pub_types (int $index) }} + </option> + {{ end }} + </select> + </div> + <div class="col-auto"> + <select class="pub-filters form-control form-control-sm" data-filter-group="year"> + <option value="*">{{ i18n "date" }}</option> + {{ $years_sorted := $.Scratch.GetSortedMapValues "years" }} + {{ if $years_sorted }} + {{ range $year := sort $years_sorted "" "desc" }} + <option value=".year-{{ $year }}"> + {{ $year }} + </option> + {{ end }} + {{ end }} + </select> + </div> + </div> + + <div id="container-publications"> + {{ range .Pages.ByDate.Reverse }} + + {{ if .Params.publication_types }} + {{ $.Scratch.Set "pubtype" (index .Params.publication_types 0) }} + {{ else }} + {{ $.Scratch.Set "pubtype" 0 }} + {{ end }} + + <div class="grid-sizer col-lg-12 isotope-item pubtype-{{ $.Scratch.Get "pubtype" }} year-{{ .Date.Format "2006" }}"> + {{ if eq $.Params.view 1 }} + {{ partial "li_list" . }} + {{ else if eq $.Params.view 3 }} + {{ partial "li_card" . }} + {{ else if eq $.Params.view 4 }} + {{ partial "li_citation" . }} + {{ else }} + {{ partial "li_compact" . }} + {{ end }} + </div> + + {{ end }} + </div> + + </div> + </div> +</div> + +{{- end -}} diff --git a/layouts/section/talk.html b/layouts/section/talk.html new file mode 100644 index 0000000..a2c624b --- /dev/null +++ b/layouts/section/talk.html @@ -0,0 +1,41 @@ +{{- define "main" -}} + +{{ partial "page_header.html" . }} + +<div class="universal-wrapper"> + <div class="row"> + <div class="col-lg-12"> + + {{ with .Content }} + <div class="article-style" itemprop="articleBody">{{ . }}</div> + {{ end }} + + {{ range .Data.Pages.GroupByDate "2006" }} + <div class="row" id="talk_list"> + <div class="col-lg-2"> + <h3>{{ .Key }}</h3> + </div> + <div class="col-lg-10"> + + {{ range .Pages }} + {{ if eq $.Params.view 1 }} + {{ partial "li_list" . }} + {{ else if eq $.Params.view 3 }} + <div class="col-lg-4 col-md-6 mb-4"> + {{ partial "li_card" . }} + </div> + {{ else }} + {{ partial "li_compact" . }} + {{ end }} + {{ end }} + + </div> + </div> + {{ end }} + + </div> + </div> + +</div> + +{{- end -}} diff --git a/layouts/shortcodes/alert.html b/layouts/shortcodes/alert.html new file mode 100644 index 0000000..9712fbd --- /dev/null +++ b/layouts/shortcodes/alert.html @@ -0,0 +1,5 @@ +<div class="alert alert-{{ .Get 0 }}"> + <div> + {{ .Inner | markdownify | emojify }} + </div> +</div> diff --git a/layouts/shortcodes/diagram.html b/layouts/shortcodes/diagram.html new file mode 100644 index 0000000..33fdc82 --- /dev/null +++ b/layouts/shortcodes/diagram.html @@ -0,0 +1,3 @@ +<div class="mermaid"> + {{- safeHTML .Inner -}} +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html new file mode 100644 index 0000000..867edf7 --- /dev/null +++ b/layouts/shortcodes/figure.html @@ -0,0 +1,29 @@ +{{/* Enable image to be loaded from local page dir or media library at `static/img/`. */}} +{{ $image_src := .Get "src" }} +{{ if .Get "library" }} + {{ $image_src = printf "img/%s" $image_src | relURL }} +{{ end }} +{{ $lightbox := eq (.Get "lightbox" | default "false") "true" }} +{{ $group := .Get "lightbox-group" | default "" }} + +<figure{{ with .Get "class" }} class="{{.}}"{{ end }}> +{{ if $lightbox }} + <a data-fancybox="{{$group}}" href="{{$image_src}}" {{ with .Get "caption"}}data-caption="{{ .|markdownify|emojify }}"{{ end }}> +{{ else if .Get "link"}} + <a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{.}}"{{ end }}{{ with .Get "rel" }} rel="{{.}}"{{ end }}> +{{ end }} +<img src="{{$image_src}}" {{ if or (.Get "alt") (.Get "caption") }}alt="{{ with .Get "alt"}}{{.}}{{else}}{{ .Get "caption" }}{{ end }}" {{ end }}{{ with .Get "width" }}width="{{.}}" {{ end }}{{ with .Get "height" }}height="{{.}}" {{ end }}> +{{ if or $lightbox (.Get "link") }}</a>{{ end }} +{{ if or (or (.Get "title") (.Get "caption")) (.Get "attr")}} +{{ $figure := split (i18n "figure" | default "Figure %d:") "%d" }} +<figcaption data-pre="{{ index $figure 0 }}" data-post="{{ index $figure 1 }}" {{ if eq (.Get "numbered") "true" }}class="numbered"{{ end }}> + {{ if isset .Params "title" }}<h4>{{ .Get "title" | markdownify | emojify }}</h4>{{ end }} + {{ if or (.Get "caption") (.Get "attr")}}<p> + {{ .Get "caption" | markdownify | emojify }} + {{ with .Get "attrlink"}}<a href="{{.}}"> {{ end }} + {{ .Get "attr" }} + {{ if .Get "attrlink"}}</a> {{ end }} + </p> {{ end }} +</figcaption> +{{ end }} +</figure> diff --git a/layouts/shortcodes/fragment.html b/layouts/shortcodes/fragment.html new file mode 100644 index 0000000..312208b --- /dev/null +++ b/layouts/shortcodes/fragment.html @@ -0,0 +1,3 @@ +<span class="fragment {{ .Get "class" }}" {{ with .Get "weight" }}data-fragment-index="{{ . }}"{{ end }}> + {{ .Inner }} +</span>
\ No newline at end of file diff --git a/layouts/shortcodes/gallery.html b/layouts/shortcodes/gallery.html new file mode 100644 index 0000000..04d9942 --- /dev/null +++ b/layouts/shortcodes/gallery.html @@ -0,0 +1,56 @@ +{{/* Get album folder or default to `gallery/`. */}} +{{ $album := "" }} +{{ with .Get "album" }}{{ $album = . }}{{else}}{{ $album = "gallery" }}{{end}} + +{{/* Set image path and page bundle that images are associated with. */}} +{{ $album_path := "" }} +{{ $resource_page := "" }} +{{ if eq .Page.Parent.Type "widget_page" }} + {{ $album_path = printf "%s/%s/*" (path.Base (path.Split .Page.Path).Dir) $album }} + {{ $resource_page = $.Page.Parent }} +{{ else }} + {{ $album_path = printf "%s/*" $album }} + {{ $resource_page = $.Page }} +{{ end }} + +<div class="gallery"> + + {{/* Attempt to automatically load gallery images from page bundle */}} + {{ $images := ($resource_page.Resources.ByType "image").Match $album_path }} + {{ with $images }} + {{ range $images }} + {{ $image := .Resize "x190" }} + {{/* Check if the user set a caption for this image */}} + {{ $filename := path.Base .Name }} + {{ $caption := "" }} + {{ if $.Page.Params.gallery_item }} + {{ range (where (where $.Page.Params.gallery_item "album" $album) "image" $filename) }} + {{ $caption = .caption }} + {{ end }} + {{ end }} + <a data-fancybox="gallery-{{$album}}" href="{{ .RelPermalink }}" {{ with $caption }}data-caption="{{.|markdownify|emojify|safeHTMLAttr}}"{{ end }}> + <img src="{{ $image.RelPermalink }}" alt=""> + </a> + {{end}} + + {{else}} + {{/* Load gallery images from the `static/img/` media library or internet */}} + + {{ if $.Page.Params.gallery_item }} + {{ range (where $.Page.Params.gallery_item "album" $album) }} + {{/* Set image path. */}} + {{ $.Scratch.Set "src" .image }} + {{ if gt (len .image) 4 }} + {{ if ne "http" (slicestr .image 0 4) }} + {{ $.Scratch.Set "src" (printf "img/%s" .image | relURL) }} + {{ end }} + {{ end }} + <a data-fancybox="gallery{{ with .album }}-{{.}}{{ end }}" {{ with .caption }}data-caption="{{.|markdownify|emojify|safeHTMLAttr}}"{{ end }} href="{{$.Scratch.Get "src"}}"> + <img src="{{$.Scratch.Get "src"}}" alt=""> + </a> + {{end}} + {{else}} + {{ errorf "Unable to load gallery in %s." .Page.File.Filename }} + {{end}} + {{end}} +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/gdocs.html b/layouts/shortcodes/gdocs.html new file mode 100644 index 0000000..aa3ad33 --- /dev/null +++ b/layouts/shortcodes/gdocs.html @@ -0,0 +1,3 @@ +<div class="responsive-wrap"> + <iframe src="{{ .Get "src" }}" frameborder="0" width="960" height="569" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe> +</div>
\ No newline at end of file diff --git a/layouts/shortcodes/hl.html b/layouts/shortcodes/hl.html new file mode 100644 index 0000000..f56cb01 --- /dev/null +++ b/layouts/shortcodes/hl.html @@ -0,0 +1 @@ +<span class="markup-quote">{{ .Inner | markdownify | emojify }}</span>
\ No newline at end of file diff --git a/layouts/shortcodes/list_categories.html b/layouts/shortcodes/list_categories.html new file mode 100644 index 0000000..7bbf986 --- /dev/null +++ b/layouts/shortcodes/list_categories.html @@ -0,0 +1,5 @@ +<ul class="list-unstyled"> + {{ range site.Taxonomies.categories }} + <li><a href="{{.Page.RelPermalink}}">{{.Page.Title}}</a></li> + {{ end }} +</ul>
\ No newline at end of file diff --git a/layouts/shortcodes/list_tags.html b/layouts/shortcodes/list_tags.html new file mode 100644 index 0000000..4384812 --- /dev/null +++ b/layouts/shortcodes/list_tags.html @@ -0,0 +1,5 @@ +<ul class="list-unstyled"> + {{ range site.Taxonomies.tags }} + <li><a href="{{.Page.RelPermalink}}">{{.Page.Title}}</a></li> + {{ end }} +</ul>
\ No newline at end of file diff --git a/layouts/shortcodes/slide.html b/layouts/shortcodes/slide.html new file mode 100644 index 0000000..d3bced6 --- /dev/null +++ b/layouts/shortcodes/slide.html @@ -0,0 +1,6 @@ +{{ $non_data_attributes := slice "id" "class" }} +<section data-noprocess data-shortcode-slide + {{ range $key, $value := $.Params }} + {{ $attribute := cond (in $non_data_attributes $key) $key (delimit (slice "data" $key) "-") }} + {{ $attribute | safeHTMLAttr }}="{{ $value }}" + {{ end }}> diff --git a/layouts/shortcodes/speaker_note.html b/layouts/shortcodes/speaker_note.html new file mode 100644 index 0000000..e2b7210 --- /dev/null +++ b/layouts/shortcodes/speaker_note.html @@ -0,0 +1,3 @@ +<aside class="notes"> + {{ .Inner | markdownify | emojify }} +</aside>
\ No newline at end of file diff --git a/layouts/shortcodes/staticref.html b/layouts/shortcodes/staticref.html new file mode 100644 index 0000000..c6e99f4 --- /dev/null +++ b/layouts/shortcodes/staticref.html @@ -0,0 +1 @@ +<a href="{{ .Get 0 | relURL }}"{{ if len .Params | eq 2 }} target="_blank"{{ end }}>{{ .Inner }}</a>
\ No newline at end of file diff --git a/layouts/shortcodes/toc.html b/layouts/shortcodes/toc.html new file mode 100644 index 0000000..31dd72c --- /dev/null +++ b/layouts/shortcodes/toc.html @@ -0,0 +1,2 @@ +<h2>{{ i18n "table_of_contents" }}</h2> +{{ $.Page.TableOfContents }} diff --git a/layouts/shortcodes/video.html b/layouts/shortcodes/video.html new file mode 100644 index 0000000..f4d16bc --- /dev/null +++ b/layouts/shortcodes/video.html @@ -0,0 +1,27 @@ +{{/* Enable video to be loaded from local page dir or media library at `static/img/`. */}} +{{ $path := "" }} +{{ $root_dir := "" }} +{{ if .Get "library" }} + {{ $path = "img/" }} + {{ $root_dir = "static/" }} +{{ end }} + +{{ $video := printf "%s%s" $path (.Get "src") }} +{{ $video_type := substr (.Get "src") -1 3 }} +{{ if .Get "library" }} + {{ $video = $video | relURL }} +{{ end }} + +{{ $poster := printf "%s%s%s" $path (substr (.Get "src") 0 -4) ".jpg" }} +{{ $has_poster := fileExists (printf "%s%s" $root_dir $poster) }} +{{ if and $has_poster (.Get "library") }} + {{ $poster = $poster | relURL }} +{{ else if $has_poster }} + {{ $poster = $poster }} +{{ else }} + {{ $poster = "" }} +{{ end }} + +<video {{if (.Get "controls")}}controls{{else}}autoplay loop{{end}} {{with $poster}}poster="{{.}}"{{end}}> + <source src="{{ $video }}" type="video/{{$video_type}}"> +</video>
\ No newline at end of file diff --git a/layouts/slides/baseof.html b/layouts/slides/baseof.html new file mode 100644 index 0000000..d98b790 --- /dev/null +++ b/layouts/slides/baseof.html @@ -0,0 +1,67 @@ +<!DOCTYPE html> +<html lang="{{ site.LanguageCode | default "en-us" }}"> +<head> + {{ $css := site.Data.assets.css }} + {{ $cdn_url_reveal := "https://cdnjs.cloudflare.com/ajax/libs/reveal.js/3.8.0" }} + + <meta charset="utf-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="generator" content="Source Themes Academic {{ site.Data.academic.version }}"> + + <link rel="manifest" href="{{ "site.webmanifest" | relURL }}"> + <link rel="icon" type="image/png" href="{{ "/img/icon.png" | relURL }}"> + <link rel="apple-touch-icon" type="image/png" href="{{ "/img/icon-192.png" | relURL }}"> + + <link rel="canonical" href="{{ .Permalink }}"> + + <title>{{ .Title }} | {{ site.Title }}</title> + + <link rel="stylesheet" href="{{ $cdn_url_reveal }}/css/reveal.min.css"> + {{- $theme := $.Param "slides.theme" | default "black" -}} + <link rel="stylesheet" href="{{ $cdn_url_reveal }}/css/theme/{{ $theme }}.min.css"> + + {{- $highlight_style := $.Param "slides.highlight_style" | default "dracula" -}} + {{ printf "<link rel=\"stylesheet\" href=\"%s\" crossorigin=\"anonymous\">" (printf $css.highlight.url $css.highlight.version $highlight_style) | safeHTML }} + + {{ $css := resources.Get "css/reveal.css" }} + {{ $css_custom := resources.Get "css/reveal_custom.css" }} + {{ $style := slice $css $css_custom | resources.Concat "css/reveal_custom.css" | resources.Minify }} + <link rel="stylesheet" href="{{ $style.RelPermalink }}"> + + <!-- Printing and PDF exports --> + <script> + var link = document.createElement( 'link' ); + link.rel = 'stylesheet'; + link.type = 'text/css'; + link.href = window.location.search.match( /print-pdf/gi ) ? '{{ $cdn_url_reveal }}/css/print/pdf.css' : '{{ $cdn_url_reveal }}/css/print/paper.css'; + document.getElementsByTagName( 'head' )[0].appendChild( link ); + </script> + +</head> +<body> + + {{ block "main" . }}{{ end }} + + <script src="{{ $cdn_url_reveal }}/lib/js/head.min.js"></script> + <script src="{{ $cdn_url_reveal }}/js/reveal.min.js"></script> + + <script> + window.revealPlugins = { dependencies: [ + { src: '{{ $cdn_url_reveal }}/plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '{{ $cdn_url_reveal }}/plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } }, + { src: '{{ $cdn_url_reveal }}/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }, + { src: '{{ $cdn_url_reveal }}/plugin/zoom-js/zoom.js', async: true }, + { src: '{{ $cdn_url_reveal }}/plugin/math/math.js', async: true }, + { src: '{{ $cdn_url_reveal }}/plugin/print-pdf/print-pdf.js', async: true }, + // Notes plugin must be loaded locally as CDN is missing `notes.html`. + { src: '{{ "js/vendor/reveal.js/plugin/notes/notes.js" | relURL }}', async: true } + ]}; + + let revealDefaults = { center: true, controls: true, history: true, progress: true, transition: 'slide', mouseWheel: true }; + let revealOptions = Object.assign({}, revealDefaults, revealPlugins); + Reveal.initialize(revealOptions); + </script> + +</body> +</html> diff --git a/layouts/slides/list.html b/layouts/slides/list.html new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/layouts/slides/list.html diff --git a/layouts/slides/single.html b/layouts/slides/single.html new file mode 100644 index 0000000..6bd27b1 --- /dev/null +++ b/layouts/slides/single.html @@ -0,0 +1,3 @@ +{{ define "main" }} +{{ partial "slides" (union (slice .Page) .Pages) }} +{{ end }} diff --git a/layouts/talk/single.html b/layouts/talk/single.html new file mode 100644 index 0000000..c9ac7d3 --- /dev/null +++ b/layouts/talk/single.html @@ -0,0 +1,83 @@ +{{- define "main" -}} + +<div class="pub py-5" itemscope itemtype="http://schema.org/Event"> + + {{ partial "page_header.html" . }} + + <div class="article-container"> + + {{ if .Params.abstract }} + <h3>{{ i18n "abstract" }}</h3> + <p class="pub-abstract" itemprop="text">{{ .Params.abstract | markdownify | emojify }}</p> + {{ else }} + <br> + {{ end }} + + <div class="row"> + <div class="col-md-10 mx-auto"> + <div class="row"> + <div class="col-12 col-md-3 pub-row-heading">{{ i18n "date" }}</div> + <div class="col-12 col-md-9" itemprop="datePublished"> + {{ $date := .Date }} + {{ (time $date).Format site.Params.date_format }} + <div class="talk-time"> + {{ if not .Params.all_day }} + {{ (time $date).Format (site.Params.time_format | default "3:04 PM") }} + {{ with .Params.date_end }} + — {{ (time .).Format (site.Params.time_format | default "3:04 PM") }} + {{ end }} + {{ end }} + </div> + </div> + </div> + </div> + </div> + <div class="d-md-none space-below"></div> + + <div class="row"> + <div class="col-md-10 mx-auto"> + <div class="row"> + <div class="col-12 col-md-3 pub-row-heading">{{ i18n "event" }}</div> + <div class="col-12 col-md-9"> + {{ with .Params.event_url }}<a href="{{ . }}" target="_blank" rel="noopener">{{ end }} + {{ .Params.event | markdownify }} + {{ if .Params.event_url }}</a>{{ end }} + </div> + </div> + </div> + </div> + <div class="d-md-none space-below"></div> + + {{ with .Params.location }} + <div class="row"> + <div class="col-md-1"></div> + <div class="col-md-10"> + <div class="row"> + <div class="col-12 col-md-3 pub-row-heading">{{ i18n "location" }}</div> + <div class="col-12 col-md-9">{{ . | markdownify }}</div> + </div> + </div> + <div class="col-md-1"></div> + </div> + <div class="d-md-none space-below"></div> + {{ end }} + + <div class="space-below"></div> + + <div class="article-style"> + {{ .Content }} + </div> + + {{ partial "tags.html" . }} + {{ partial "page_author.html" . }} + + </div> +</div> + +{{ if site.Params.section_pager }} +<div class="article-container article-widget"> + {{ partial "section_pager.html" . }} +</div> +{{ end }} + +{{- end -}} diff --git a/layouts/widget_page/single.html b/layouts/widget_page/single.html new file mode 100644 index 0000000..842aa89 --- /dev/null +++ b/layouts/widget_page/single.html @@ -0,0 +1,3 @@ +{{- define "main" -}} +{{ partial "widget_page.html" . }} +{{- end -}} |