Simple site layout design
This commit is contained in:
5
layouts/_partials/favicon.html
Normal file
5
layouts/_partials/favicon.html
Normal file
@ -0,0 +1,5 @@
|
||||
{{- $faviconsDir := absURL site.Params.faviconsDir }}
|
||||
<link rel="apple-touch-icon" sizes="180x180" href='{{ printf "%sapple-touch-icon.png" $faviconsDir }}'>
|
||||
<link rel="icon" type="image/png" sizes="32x32" href='{{ printf "%sfavicon-32x32.png" $faviconsDir }}'>
|
||||
<link rel="icon" type="image/png" sizes='16x16' href='{{ printf "%sfavicon-16x16.png" $faviconsDir }}'>
|
||||
<link rel="manifest" href='{{ printf "%ssite.webmanifest" $faviconsDir }}'>
|
@ -1,5 +1,12 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width">
|
||||
<!-- <meta name="viewport" content="width=device-width"> -->
|
||||
<meta name="viewport" content ="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>{{ if .IsHome }}{{ site.Title }}{{ else }}{{ printf "%s | %s" .Title site.Title }}{{ end }}</title>
|
||||
{{ partialCached "head/css.html" . }}
|
||||
{{ partialCached "head/js.html" . }}
|
||||
{{- partial "opengraph" . }}
|
||||
{{- partialCached "favicon" . }}
|
||||
{{- partialCached "styles" . }}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
{{- with resources.Get "css/main.css" }}
|
||||
{{- if hugo.IsDevelopment }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}">
|
||||
{{- else }}
|
||||
{{- with . | minify | fingerprint }}
|
||||
<link rel="stylesheet" href="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous">
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
@ -1,16 +0,0 @@
|
||||
{{- with resources.Get "js/main.js" }}
|
||||
{{- $opts := dict
|
||||
"minify" (not hugo.IsDevelopment)
|
||||
"sourceMap" (cond hugo.IsDevelopment "external" "")
|
||||
"targetPath" "js/main.js"
|
||||
}}
|
||||
{{- with . | js.Build $opts }}
|
||||
{{- if hugo.IsDevelopment }}
|
||||
<script src="{{ .RelPermalink }}"></script>
|
||||
{{- else }}
|
||||
{{- with . | fingerprint }}
|
||||
<script src="{{ .RelPermalink }}" integrity="{{ .Data.Integrity }}" crossorigin="anonymous"></script>
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
0
layouts/_partials/head/sass.html
Normal file
0
layouts/_partials/head/sass.html
Normal file
@ -1,2 +1,2 @@
|
||||
<h1>{{ site.Title }}</h1>
|
||||
<h1><a href="{{ "/" | relURL }}">{{ site.Title }}</a></h1>
|
||||
{{ partial "menu.html" (dict "menuID" "main" "page" .) }}
|
||||
|
70
layouts/_partials/opengraph.html
Normal file
70
layouts/_partials/opengraph.html
Normal file
@ -0,0 +1,70 @@
|
||||
{{- $config := site.Params }}
|
||||
{{- $permalink := .Permalink }}
|
||||
{{ $st := site.Title }}
|
||||
{{- $summary := "" }}
|
||||
{{- with .Summary }}
|
||||
{{- $summary = . }}
|
||||
{{- else }}
|
||||
{{- $summary = $config.description }}
|
||||
{{- end }}
|
||||
{{- $summary = truncate 160 "" $summary }}
|
||||
{{- $logo := absURL (printf "images/%s" $config.logo) }}
|
||||
{{- if in $config.logo "https://" }}
|
||||
{{- $logo = $config.logo }}
|
||||
{{- end }}
|
||||
{{ $image := "" }}
|
||||
{{- with .Params.image }}
|
||||
{{ if in . "https://" }}
|
||||
{{- $image = . }}
|
||||
{{ else }}
|
||||
{{- $image = absURL (printf "images/%s" .) }}
|
||||
{{ end }}
|
||||
{{- else }}
|
||||
{{- $image = $logo }}
|
||||
{{- end }}
|
||||
<meta name="keywords" content="{{ $st }}">
|
||||
<meta property="og:locale" content='{{ default "en_US" $config.locale }}'>
|
||||
<meta property="og:type" content="article">
|
||||
<meta property="og:title" content="{{ .Title }}">
|
||||
<meta property="og:description" content="{{ $summary }}">
|
||||
<meta property="og:url" content="{{ $permalink }}">
|
||||
<meta property="og:image" content="{{ $image }}">
|
||||
{{- if eq .Section $config.blogDir -}}
|
||||
{{- $date := .Date.Format "2006-02-01" -}}
|
||||
<meta property="article:published_time" content="{{ htmlUnescape $date }}" />
|
||||
<script type="application/ld+json">
|
||||
{
|
||||
"@context": "http://schema.org",
|
||||
"@type": "BlogPosting",
|
||||
"mainEntityOfPage":"{{ $permalink }}",
|
||||
"name": "{{ $st }}",
|
||||
"headline": "{{ .Title }}",
|
||||
"description": "{{ $summary }}",
|
||||
"url": "{{ $permalink }}",
|
||||
"datePublished": "{{ $date }}",
|
||||
"dateModified": "{{ $date }}",
|
||||
"author": {
|
||||
"@type": "Person",
|
||||
"name": "{{ .Params.author }}"
|
||||
},
|
||||
"image":{
|
||||
"@type":"ImageObject",
|
||||
"url": "{{ $image }}"
|
||||
},
|
||||
"publisher": {
|
||||
"@type": "Organization",
|
||||
"logo": {
|
||||
"@type":"ImageObject",
|
||||
"url": "{{ $logo }}"
|
||||
},
|
||||
"name": "{{ $st }}"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:creator" content="{{ $config.twitter }}">
|
||||
<meta name="twitter:title" content="{{ .Title }}">
|
||||
<meta name="twitter:description" content="{{ $summary }}">
|
||||
<meta name="twitter:image" content="{{ $image }}">
|
||||
{{- end }}
|
||||
<link rel="canonical" href="{{ $permalink }}">
|
4
layouts/_partials/styles.html
Normal file
4
layouts/_partials/styles.html
Normal file
@ -0,0 +1,4 @@
|
||||
{{- $options := (dict "targetPath" "css/styles.css" "outputStyle" "expanded" "enableSourceMap" "true") -}}
|
||||
{{ $mainSassFile := "sass/main.sass" }}
|
||||
{{- $styles := resources.Get $mainSassFile | resources.ExecuteAsTemplate $mainSassFile . | css.Sass $options | resources.Fingerprint "sha512" }}
|
||||
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}">
|
14
layouts/_partials/term-link.html
Normal file
14
layouts/_partials/term-link.html
Normal file
@ -0,0 +1,14 @@
|
||||
{{ $name := .name }}
|
||||
{{ $taxonomy := .taxonomy }}
|
||||
|
||||
{{ $hash := md5 $name }}
|
||||
{{ $r := printf "0x%s" (substr $hash 0 2) | int }}
|
||||
{{ $g := printf "0x%s" (substr $hash 2 2) | int }}
|
||||
{{ $b := printf "0x%s" (substr $hash 4 2) | int }}
|
||||
{{ $rgba := printf "rgba(%d,%d,%d,0.2)" $r $g $b }}
|
||||
<a
|
||||
id="{{ $taxonomy | urlize }}_{{ $name | urlize }}"
|
||||
style="background:rgba({{ $r }},{{ $g }},{{ $b }},0.4)"
|
||||
href="{{ "/" | relLangURL}}{{ $taxonomy | urlize }}{{ "/" | relLangURL}}{{ $name | urlize }}">
|
||||
{{ $name }}
|
||||
</a>
|
@ -1,23 +1,23 @@
|
||||
{{- /*
|
||||
For a given taxonomy, renders a list of terms assigned to the page.
|
||||
|
||||
@context {page} page The current page.
|
||||
@context {string} taxonomy The taxonomy.
|
||||
|
||||
@example: {{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
|
||||
*/}}
|
||||
{{- .Site }}
|
||||
<section>
|
||||
<ul id="all-taxonomies">
|
||||
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
|
||||
{{ $taxonomyname }}
|
||||
<li><a href="{{ "/" | relLangURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a>
|
||||
<ul>
|
||||
{{ range $key, $value := $taxonomy }}
|
||||
<li> {{ $key }} </li>
|
||||
<ul>
|
||||
{{ range $value.Pages }}
|
||||
<li hugo-nav="{{ .RelPermalink}}"><a href="{{ .Permalink}}"> {{ .LinkTitle }} </a> </li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
{{- $page := .page }}
|
||||
{{- $taxonomy := .taxonomy }}
|
||||
|
||||
{{- with $page.GetTerms $taxonomy }}
|
||||
{{- $label := (index . 0).Parent.LinkTitle }}
|
||||
<div>
|
||||
<div>{{ $label }}:</div>
|
||||
<ul>
|
||||
{{- range . }}
|
||||
<li><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
|
||||
{{- end }}
|
||||
</ul>
|
||||
</div>
|
||||
{{- end }}
|
||||
|
@ -6,5 +6,21 @@
|
||||
<time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
|
||||
|
||||
{{ .Content }}
|
||||
{{ partial "terms.html" (dict "taxonomy" "tags" "page" .) }}
|
||||
|
||||
<section>
|
||||
<ul id="taxonomies">
|
||||
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
|
||||
<li>{{ $taxonomyname | strings.FirstUpper }}
|
||||
<!-- <li><a href="{{ "/" | relLangURL}}{{ $taxonomyname | urlize }}">{{ $taxonomyname }}</a> -->
|
||||
<ul>
|
||||
{{ range $key, $value := $taxonomy }}
|
||||
<li><a href="{{ "/" | relLangURL}}{{ $taxonomyname | urlize }}{{ "/" | relLangURL}}{{ $key | urlize }}">{{ $key }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
|
||||
{{ end }}
|
||||
|
86
layouts/tools/page.html
Normal file
86
layouts/tools/page.html
Normal file
@ -0,0 +1,86 @@
|
||||
{{ define "main" }}
|
||||
<h1>{{ .Title }}</h1>
|
||||
|
||||
{{ $dateMachine := .Date | time.Format "2006-01-02T15:04:05-07:00" }}
|
||||
{{ $dateHuman := .Date | time.Format ":date_long" }}
|
||||
Updated <time datetime="{{ $dateMachine }}">{{ $dateHuman }}</time>
|
||||
|
||||
{{ with .Params.links }}
|
||||
<section>
|
||||
<h2>Links</h2>
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<li><a href="{{ .url }}" target="_blank" rel="noopener">{{ .title }}</a></li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.website }}
|
||||
<p>
|
||||
Website: <a href="{{ . }}" target="_blank" rel="noopener">{{ . }}</a>
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
{{ with .Params.github }}
|
||||
<p>
|
||||
<a href="{{ . }}" target="_blank" rel="noopener">View on GitHub</a>
|
||||
</p>
|
||||
{{ end }}
|
||||
|
||||
<section>
|
||||
<h2>At a Glance</h2>
|
||||
<table id="taxonomies">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Taxonomy</th>
|
||||
<th>Terms</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{ range $taxonomyname, $taxonomy := .Site.Taxonomies }}
|
||||
{{ with $taxonomy }}
|
||||
<tr>
|
||||
<th>{{ $taxonomyname | strings.FirstUpper }}</th>
|
||||
<td>
|
||||
{{ range $key, $value := $taxonomy }}
|
||||
{{ partial "term-link.html" (dict "name" $key "taxonomy" $taxonomyname) }}
|
||||
{{ end }}
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h2>Description</h2>
|
||||
{{ .Content }}
|
||||
</section>
|
||||
|
||||
{{ with .Params.publications}}
|
||||
<section>
|
||||
<h2>Publications</h2>
|
||||
<ul>
|
||||
{{ range $citation, $pub := site.Data.publications }}
|
||||
{{ range $pub }}
|
||||
{{ if in $.Params.publications .key }}
|
||||
<li>
|
||||
{{ if .year }} <strong>{{ .year }}</strong>: {{ end }}
|
||||
{{ if .title }} <em>{{ .title }}</em> {{ end }}
|
||||
{{ if .author }} <br /> by {{ delimit .author " | " | html }} {{ end }}
|
||||
{{ if .booktitle }} <br />Appears in <em>{{ .booktitle }}</em> {{ end }}
|
||||
{{ if .journal }} <br />Appears in <em>{{ .journal }}</em> {{ end }}
|
||||
{{ if .volume }} <strong>{{ .volume }}</strong> {{ end }}
|
||||
{{ if .pages }} ({{ .pages }}) {{ end }}
|
||||
{{ if .doi }} <br /><a href="https://doi.org/{{ . }}" target="_blank" rel="noopener">DOI: {{ .doi }}</a> {{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
</section>
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
Reference in New Issue
Block a user