First version of the theme

This commit is contained in:
Gregory Trolliet 2021-10-26 11:34:30 +02:00
commit 8dd30f6eb8
61 changed files with 1658 additions and 0 deletions

20
layouts/404.html Normal file
View file

@ -0,0 +1,20 @@
{{ define "main"}}
<main id="wrapper">
<section class="container error_page">
<div>
<h1 id="title">
{{ with .Site.Params.error404_definitionUrl }}
<a title="{{ i18n "error_404_title" }}" href="{{ . }}">
{{ end }}
{{ htmlUnescape (i18n "error_404") }}
{{ with .Site.Params.error404_definitionUrl }}
</a>
{{ end }}
</h1>
<p>{{ i18n "error_404_txt" }}</p>
<p>{{ i18n "error_404_reasons" | markdownify }}</p>
</div>
<footer><a href="{{ "/" | relURL }}">{{ i18n "go_home" }}</a></footer>
</section>
</main>
{{ end }}

View file

@ -0,0 +1,7 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}">
<a class="anchor" href="#{{ .Anchor | safeURL }}">
#
<!-- {{ strings.Repeat .Level "#" }} -->
</a>
{{ .Text | safeHTML }}
</h{{ .Level }}>

View file

@ -0,0 +1,12 @@
{{ partial "header.html" . }}
<body>
<!-- Code that all your templates share, like a header -->
{{ block "main" . }}
<!-- The part of the page that begins to differ between templates -->
{{ end }}
{{ block "footer" . }}
<!-- More shared code, perhaps a footer but that can be overridden if need be in -->
{{ end }}
</body>
</html>

6
layouts/_default/li.html Normal file
View file

@ -0,0 +1,6 @@
<li>
<span class="date">
{{ .Date.Day }} {{ index $.Site.Data.snotra.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}
</span>
<a class="title" href="{{ .Params.ExternalLink | default .RelPermalink }}">{{ .Title }}</a>
</li>

View file

@ -0,0 +1,28 @@
{{ partial "header.html" . }}
<body>
<main class="wrapper">
{{ partial "navigation.html" . }}
<section id="blog-list" class="container liste">
<article>
<header>
<h1 class="list-title">
{{ if eq .Kind "taxonomy" }}
{{ i18n .Data.Plural 1 | title }}: {{ .Title }}
{{ else if eq .Kind "taxonomyTerm" }}
{{ i18n .Data.Plural | title }}
{{ end }}
</h1>
</header>
<ul class="articles-list">
{{- range .Paginator.Pages -}}
{{- .Render "li" -}}
{{- end -}}
</ul>
</article>
{{ .Content }}
{{ partial "pagination.html" . }}
</section>
</main>
</body>
</html>

26
layouts/_default/rss.xml Normal file
View file

@ -0,0 +1,26 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range .Site.RegularPages }}
<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>

View file

@ -0,0 +1,16 @@
{{ partial "header.html" . }}
<body>
<main class="wrapper">
{{ partial "navigation.html" . }}
<section id="site-page" class="container page">
<article>
<header>
<h1 class="site-title">{{ .Title }}</h1>
</header>
{{ .Content }}
</article>
</section>
{{ partial "footer.html" . }}
</main>
</body>
</html>

5
layouts/archives/li.html Normal file
View file

@ -0,0 +1,5 @@
<a class="archive hidden_link" href="{{ .Params.ExternalLink | default .RelPermalink }}">
<img class="thumbnail" src="{{ .RelPermalink }}/thumb.jpg" />
<span class="description">{{ .Title }}</span>
<span class="more">&rarr; plus d'infos</span>
</a>

View file

@ -0,0 +1,24 @@
{{ partial "header.html" . }}
<body>
<main class="wrapper">
{{ partial "navigation.html" . }}
<section id="blog-list" class="container liste">
<article>
<header>
<h1 class="list-title">
{{ i18n "articles" | title }}
</h1>
</header>
<div class="archives-list">
{{- range .Paginator.Pages -}}
{{- .Render "li" -}}
{{- end -}}
</div>
</article>
{{ partial "pagination.html" . }}
</section>
{{ partial "footer.html" . }}
</main>
</body>
</html>

View file

@ -0,0 +1,63 @@
{{ partial "header.html" . }}
<body>
<main class="wrapper">
{{ partial "navigation.html" . }}
<section class="container archive">
<article>
<header class="post-header">
<h1 class="post-title">
{{ .Title }}
</h1>
{{ $img := newScratch }}
{{ $folder := (print "/content/" .File.Dir "gallery/") }}
{{ $files := readDir $folder }}
{{ range sort $files "Name" "asc" }}
{{ if not .IsDir }}
{{ $img.Add "list" (slice .Name) }}
{{ end }}
{{ end }}
{{ with ($img.Get "list") }}
{{ $img.Set "max" (add 1 (int (index (split (index (split (index (last 1 .) 0) ".") 0) "img") 1))) }}
{{ end }}
{{ range $index, $val := $img.Get "list" }}
{{ $curr := index (split $val ".") 0 }}
{{ $prec := mod (add (sub $index 1) ($img.Get "max")) ($img.Get "max") }}
{{ $next := mod (add $index 1) ($img.Get "max") }}
<a class="thumb hidden_link" href="#img{{ $index }}">
<img src="gallery/thumb/{{ $curr }}.jpg">
</a>
<!-- lightbox container hidden with CSS -->
<div class="lightbox" id="{{ $curr }}">
<a href="#img{{ $prec }}" class="light-btn hidden_link btn-prev"><<</a>
<a href="#_" class="btn-close hidden_link">X</a>
<img src="gallery/{{ $val }}">
<a href="#img{{ $next }}" class="light-btn hidden_link btn-next">>></a>
</div>
{{ end }}
<div class="post-meta">
<!--div class="date">
<span class="posted-on">
<img class="page-icon header-icon" src="/svg/calendar.svg"/>
<time datetime='{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}'>
Article publié le {{ .Date.Day }} {{ index $.Site.Data.snotra.mois (printf "%d" .Date.Month) }} {{ .Date.Year }}
</time>
</span>
<span class="reading-time">
<img class="page-icon header-icon" src="/svg/clock.svg"/>
{{ i18n "reading_time" .ReadingTime }}
</span>
</div-->
{{ partial "categories.html" .Page.Params.Categories }}
{{ partial "tags.html" .Page.Params.Tags }}
</div>
</header>
<div class="archive-body">
{{ .Content }}
</div>
{{ partial "article-footer.html" . }}
</article>
</section>
{{ partial "footer.html" . }}
</main>
</body>
</html>

21
layouts/index.html Normal file
View file

@ -0,0 +1,21 @@
{{ partial "header.html" . }}
<body>
<main class="wrapper">
{{ partial "navigation.html" . }}
<div class="centered">
{{ partial "author.html" . }}
{{ if false }}
{{ range .Site.RegularPages }}
<header>
<h2><a href="{{ .RelPermalink }}">{{ .Title }}</a></h2>
</header>
<article>
{{ .Summary }}
</article>
{{ end }}
{{ end }}
</div>
{{ partial "footer.html" . }}
</main>
</body>
</html>

View file

@ -0,0 +1,24 @@
<footer class="archive-footer">
<span class="footer-return">
<a href="#">{{ i18n "page_top" | humanize }}</a>
</span><br/>
{{ if .PrevInSection }}
<span class="footer-link">
<span class="label">{{ i18n "previous_article" | humanize }}:</span>
<a href="{{ .PrevInSection.RelPermalink }}">
{{ .PrevInSection.Title }}
</a>
{{ if .NextInSection }}
<span class="spacer"></span>
{{ end }}
</span>
{{ end }}
{{ if .NextInSection }}
<span class="footer-link">
<span class="label">{{ i18n "next_article" | humanize }}:</span>
<a href="{{ .NextInSection.RelPermalink }}">
{{ .NextInSection.Title }}
</a>
</span>
{{ end }}
</footer>

View file

@ -0,0 +1,9 @@
<div id="author">
<div id="avatar" aria-hidden="true">
<img src="images/{{ .Site.Params.avatar }}" alt="avatar"/>
</div>
<div id="description">
<h1>{{ .Site.Params.author }}</h1>
<h2>{{ .Site.Params.info }}</h2>
</div>
</div>

View file

@ -0,0 +1,13 @@
{{ if . }}
<div class="categories">
<img class="page-icon header-icon" src="/svg/folder.svg"/>
{{ range $index, $el := . }}
{{ if gt $index 0 }}
<span class="separator"></span>
{{ end }}
<a href="{{ ( printf "categories/%s/" ( $el | urlize ) ) | relLangURL }}">
{{ . }}
</a>
{{ end }}
</div>
{{ end }}

View file

@ -0,0 +1,5 @@
<div id="footer">
<div id="footer-name" class="footer-element">{{ .Site.Params.name }}</div>
<!--div id="footer-mail" class="footer-element"><a href="mailto:{{ .Site.Params.mail }}">{{ .Site.Params.mail }}</a></div-->
{{ partial "social.html" . }}
</div>

View file

View file

@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang='{{ .Site.Language.Lang }}'>
<head>
<title>{{ .Title }}</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
{{ if .Description }}
<meta name="description" content="{{ .Description }}">
{{ else }}
<meta name="description" content="{{ .Site.Params.description }}">
{{ end }}
{{ if .Params.Tags }}
<meta name="keywords" content="{{ delimit .Params.Tags ", "}}">
{{ else }}
<meta name="keywords" content="{{ .Site.Params.keywords }}">
{{ end }}
{{ if .Params.author }}
<meta name="author" content="{{ .Params.author }}">
{{ else }}
<meta name="author" content="{{ .Site.Params.author }}">
{{ end }}
<link rel="stylesheet" href="/css/style.css">
<link href="{{ .Site.RSSLink }}" rel="alternate" type="application/rss+xml" title="{{ .Site.Title }}">
{{ if and (.Site.Params.favicon) (fileExists (print "static/images/" .Site.Params.favicon)) }}
{{ $name := .Site.Params.favicon }}
{{ $splitted := split $name "." }}
{{ $extension := index $splitted 1 }}
{{ if ( in "svg" $extension) }}
<link rel="icon" type="image/svg+xml" href="{{ $.Site.BaseURL }}images/{{ $name }}" sizes="any">
{{ else if (in "gif png" $extension) }}
<link rel="icon" type="image/{{ $extension }}" href="{{ $.Site.BaseURL }}images/{{ $name }}">
{{ end}}
{{ else if (fileExists "static/images/favicon.svg") }}
<link rel="icon" type="image/svg+xml" href="{{ $.Site.BaseURL }}images/favicon.svg">
{{ else if (fileExists "static/images/favicon.png") }}
<link rel="icon" type="image/png" href="{{ $.Site.BaseURL }}images/favicon.png">
{{ end }}
{{ partial "opengraph.html" . }}
{{ range .Site.Params.custom_css }}
<link rel="stylesheet" href="{{ . | relURL }}"/>
{{ end }}
{{ hugo.Generator }}
</head>

View file

@ -0,0 +1,22 @@
<nav id="navigation">
<section class="navigation-container">
<a id="navigation-title" href="/">
{{ .Site.Title }}
</a>
<input type="checkbox" id="menu-toggle" />
<label class="menu-button" for="menu-toggle">
<div class="menu-button-inner">
<div class="menu-button-image"></div>
</div>
</label>
<ul id="navigation-list">
{{ range .Site.Home.Pages }}
<li class="navigation-item">
<a href="{{ .RelPermalink }}">{{ .Name }}</a>
</li>
{{ end }}
</ul>
</section>
</nav>

View file

@ -0,0 +1,38 @@
<meta name="twitter:card" content="summary_large_image"/>
{{ with .Site.Params.twitterUser }}
<meta name="twitter:site" content="@{{ . }}"/>
{{ end }}
<meta name="twitter:title" content="{{ .Title }}"/>
{{ if .Description }}
<meta name="twitter:description" content="{{ .Description }}"/>
{{ else }}
<meta name="twitter:description" content="{{ .Site.Params.description }}"/>
{{ end }}
<meta property="og:title" content="{{ .Title }}" />
{{ if .Description }}
<meta property="og:description" content="{{ .Description }}"/>
{{ else }}
<meta property="og:description" content="{{ .Site.Params.description }}"/>
{{ end }}
{{ if eq .Kind "page" }}
<meta property="og:type" content="article" />
{{ else }}
<meta property="og:type" content="website" />
{{ end }}
<meta property="og:url" content="{{ .Permalink }}" />
{{ $title := .Title }}
{{if .Params.images }}
{{ $baseUrl := .Permalink }}
{{ $altText := i18n "alt_image" }}
{{ range first 1 .Params.images }}
<meta property="og:image" content="{{ $baseUrl }}{{ . }}"/>
<meta property="og:image:alt" content="{{ $altText }} {{ $title }}"/>
{{ end }}
{{ else }}
<meta property="og:image" content="{{ .Site.BaseURL }}images/avatar.png"/>
<meta property="og:image:alt" content="{{ i18n "alt_avatar" . }}"/>
{{ end }}
<meta property="og:updated_time" content="{{ .Site.LastChange }}" />
<meta property="og:site_name" content="{{ .Site.Title }}" />

View file

@ -0,0 +1,51 @@
{{ $paginator := .Paginator }}
{{ $adjacent_links := 2 }}
{{ $max_links := (add (mul $adjacent_links 2) 1) }}
{{ $lower_limit := (add $adjacent_links 1) }}
{{ $upper_limit := (sub $paginator.TotalPages $adjacent_links) }}
{{ if gt $paginator.TotalPages 1 }}
<ul class="pagination">
{{ if $paginator.HasPrev }}
{{ if ne $paginator.PageNumber 2 }}
<li><a href="{{ $paginator.First.URL }}">&laquo;</a></li>
{{ end }}
<li class="hidden"><a href="{{ $paginator.Prev.URL }}">&lsaquo;</a></li>
{{ end }}
{{ range $paginator.Pagers }}
{{ $.Scratch.Set "page_number_flag" false }}
{{ if gt $paginator.TotalPages $max_links }}
{{ if le $paginator.PageNumber $lower_limit }}
{{ if le .PageNumber $max_links }}
{{ $.Scratch.Set "page_number_flag" true }}
{{ end }}
{{ else if ge $paginator.PageNumber $upper_limit }}
{{ if gt .PageNumber (sub $paginator.TotalPages $max_links) }}
{{ $.Scratch.Set "page_number_flag" true }}
{{ end }}
{{ else }}
{{ if and ( ge .PageNumber (sub $paginator.PageNumber $adjacent_links) ) ( le .PageNumber (add $paginator.PageNumber $adjacent_links) ) }}
{{ $.Scratch.Set "page_number_flag" true }}
{{ end }}
{{ end }}
{{ else }}
{{ $.Scratch.Set "page_number_flag" true }}
{{ end }}
{{ if eq ($.Scratch.Get "page_number_flag") true }}
{{ if eq . $paginator }}
<li>{{ .PageNumber }}</li>
{{ else }}
<li><a href="{{ .URL }}">{{ .PageNumber }}</a></li>
{{ end }}
{{ end }}
{{ end }}
{{ if $paginator.HasNext }}
<li class="hidden"><a href="{{ $paginator.Next.URL }}">&rsaquo;</a></li>
{{ if ne $paginator.PageNumber (sub $paginator.TotalPages 1) }}
<li><a href="{{ $paginator.Last.URL }}">&raquo;</a></li>
{{ end }}
{{ end }}
</ul>
{{ end }}

View file

@ -0,0 +1,11 @@
{{ with .Site.Params.social }}
<ul id="social">
{{ range sort . "weight" }}
<li class="social-element">
<a href="{{ safeURL .url }}" rel="me" aria-label="{{ .name }}" title="{{ .name }}">
<img class="social-icon" src="{{ .Site.BaseURL }}/svg/{{ .icon }}.svg" alt="{{ .name }}" aria-hidden="true">
</a>
</li>
{{ end }}
</ul>
{{ end }}

View file

@ -0,0 +1,11 @@
{{ if . }}
<div class="tags">
<img class="page-icon header-icon" src="/svg/tag.svg"/>
{{ range $index, $el := . }}
{{ if gt $index 0 }}
<span class="separator"></span>
{{ end }}
<a href="{{ ( printf "tags/%s/" ( $el | urlize ) ) | relLangURL }}">{{ . }}</a>
{{ end }}
</div>
{{ end }}

View file

@ -0,0 +1,42 @@
{{ $img := $.Page.Resources.GetMatch (.Get "src")}}
{{ $name_splitted := split $img.RelPermalink "." }}
{{ $name_base := index $name_splitted 0 }}
{{ $ext_base := index $name_splitted 1 }}
<figure {{ with .Get "class" }} class="{{ . }}"{{ end }}>
{{ with .Get "link" }}
<a href="{{ . | absURL }}">
{{ else }}
<a href="{{ $img.RelPermalink }}">
{{ end }}
<picture>
{{ if ( in "svg ico gif" $ext_base ) }}
<img src="{{ $img.RelPermalink }}"
{{ with .Get "alt"}} alt="{{ . }}"{{ end }}
{{ with .Get "title"}} title="{{ . }}"{{ end }}/>
{{ else }}
<source srcset="{{ $name_base }}.thumb.avif" type="image/avif"/>
<source srcset="{{ $name_base }}.thumb.webp" type="image/webp"/>
<img src="{{ $name_base }}.thumb.{{ $ext_base }}"
{{ with .Get "alt"}} alt="{{ . }}"{{ end }}
{{ with .Get "title"}} title="{{ . }}"{{ end }}/>
{{ end }}
</picture>
</a>
{{ if .Get "caption" }}
<figcaption>
<p>{{ .Get "caption" }}
{{ if .Get "attr" }}
<span class="attribution">
{{ with .Get "attrlink" }}
<a href="{{ . }}">
{{ end }}
{{ .Get "attr" }}
{{ with .Get "attrlink" }}
</a>
{{ end }}
</span>
{{ end }}
</p>
</figcaption>
{{ end }}
</figure>

View file

@ -0,0 +1,18 @@
<blockquote {{ with .Get "class" }}class="{{ . }}"{{ end }}{{ with .Get "url" }} cite="{{ . }}" {{ end }}>
{{ $s := split (trim .Inner "\t \n") "\n\n" }}
{{ if eq ( first 1 $s) ( last 1 $s )}}
<p>{{ .Inner | markdownify }}</p>
{{ else }}
{{ .Inner | markdownify }}
{{ end }}
{{ if .Get "author" }}
<footer>
<cite>
{{ with .Get "url" }}
<a href="{{ . }}" {{ with $.Get "title"}}title="{{ . }}"{{ end }}>
{{ end }}
{{ .Get "author" | markdownify }}
{{ with .Get "url" }}</a>{{end}}</cite>
</footer>
{{ end }}
</blockquote>

View file

@ -0,0 +1,3 @@
<div class="toc">
{{ .Page.TableOfContents }}
</div>

View file

@ -0,0 +1,8 @@
<figure class="tabular {{ with .Get "class"}}{{ . }}{{ end }}">
{{ .Inner | markdownify }}
{{ with .Get "title" }}
<figcaption>
<p>{{ . }}</p>
</figcaption>
{{ end }}
</figure>