feat: basic website with basic content

This commit is contained in:
Matthieu Bessat 2023-10-28 10:20:52 +02:00
parent 3379242f31
commit ba403c815f
76 changed files with 2167 additions and 4 deletions

3
layouts/404.html Normal file
View file

@ -0,0 +1,3 @@
{{ define "main" }}
<h1>Page non trouvé</h1>
{{ end }}

View file

@ -0,0 +1,11 @@
{{ if .Title }}
<figure>
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" />
<figcaption>{{ .Title }}</figcaption>
</figure>
{{ else }}
<figure>
<img src="{{ .Destination | safeURL }}" alt="{{ .Text }}" />
</figure>
{{ end }}

View file

@ -0,0 +1,23 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
{{ partial "head.html" . }}
{{- block "head" . -}}{{ end }}
</head>
<body class="{{ with .Params.body_class }}{{ . }}{{ end }}">
{{ if or (not (isset .Params "with_normal_config")) .Params.with_normal_config }}
<div class="footer-push">
{{ if or (not (isset .Params "with_header")) .Params.with_header }}
{{ partial "header" . }}
{{ end }}
{{ block "main" . }}{{ end }}
</div>
{{ if or (not (isset .Params "with_footer")) .Params.with_footer }}
{{ partial "footer" . }}
{{ end }}
{{ else }}
{{ block "main" . }}{{ end }}
{{ end }}
</body>
</html>

View file

@ -0,0 +1,26 @@
{{ define "main" }}
<main class="page-container">
{{ $listtitle := .Title }}
{{ if or .Title .Content }}
<div>
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
{{ with .Content }}<div>{{ . }}</div>{{ end }}
</div>
{{ end }}
<ul>
{{ range .Paginator.Pages }}
<li>
<div class="post-title">
{{ if eq $listtitle "Posts" }}
{{ .Date.Format "2006-01-02" }} <a href="{{ .RelPermalink }}">{{.Title }}</a>
{{ else }}
<a href="{{ .RelPermalink }}">{{.Title }}</a>
{{ end }}
</div>
</li>
{{ end }}
</ul>
{{ partial "pagination.html" . }}
</main>
{{ end }}

View file

@ -0,0 +1,32 @@
{{ define "main" }}
<main class="page-container">
<article class="article">
<h1>{{ .Title }}</h1>
{{ with .Date }}
<div>Publié le <b><time>{{ . | time.Format ":date_full" }}</time></b></div>
{{ end }}
{{ if .Params.featured_image }}
{{ $featuredImage := .Resources.GetMatch (.Params.featured_image.src | safeURL) }}
{{ if $featuredImage }}
{{ $featuredImage = $featuredImage.Resize "600x" }}
<figure>
<img alt="" src="{{ $featuredImage.RelPermalink }}" />
{{ with .Params.featured_image.caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
{{ end }}
{{ end }}
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
<div>
{{ .Content }}
</div>
</article>
</main>
{{ end }}

View file

@ -0,0 +1,13 @@
<article>
<h1><a href="{{ .Permalink }}">{{ .Title }}</a></h1>
<b><time>{{ .Date.Format (default "2006-01-02 15:04:05" .Site.Params.dateFmt) }}</time></b>
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
<div>
{{ .Summary }}
{{ if .Truncated }}
<a href="{{ .Permalink }}">Read more...</a>
{{ end }}
</div>
</article>

View file

@ -0,0 +1,53 @@
{{ define "main" }}
<main class="page-container">
{{ $listtitle := .Title }}
{{ if or .Title .Content }}
<div>
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
{{ with .Content }}<div>{{ . }}</div>{{ end }}
</div>
{{ end }}
<ul class="news-list">
{{ range .Paginator.Pages }}
<li class="news-item">
<a href="{{ .RelPermalink }}" class="news-item__image">
{{ $featuredImage := (resources.Get (printf "%s" ("cover/cover.jpg" | safeURL))) }}
{{ if .Params.featured_image }}
{{ $featuredImage = .Resources.GetMatch (.Params.featured_image.src | safeURL) }}
{{ end }}
{{ $featuredImage := $featuredImage.Resize "450x" }}
<figure>
<img alt="" src="{{ $featuredImage.RelPermalink }}" />
{{ with .Params.featured_image.caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
</a>
<div class="news-item__content">
<h2
class="news-item__title"
>
<a
href="{{ .RelPermalink }}"
>
{{.Title }}
</a>
</h2>
<p class="news-item__date">
{{ $date := .Date.Format "2006-01-02" }}
<time datetime="{{ $date }}">
{{ time.Format "2 January 2006" $date }}
</time>
</p>
<div class="news-item__summary">
{{ .Summary }}...
</div>
</div>
</li>
{{ end }}
</ul>
{{ partial "pagination.html" . }}
</main>
{{ end }}

View file

@ -0,0 +1,36 @@
{{ define "main" }}
<main class="page-container">
<article class="article">
<h1>{{ .Title }}</h1>
{{ if .Date }}
<div class="article__date">
Publié le
{{ $date := .Date.Format "2006-01-02" }}
<time date="{{ $date }}">{{ time.Format "2 January 2006" $date }}</time>
</div>
{{ end }}
{{ if .Params.featured_image }}
{{ $featuredImage := .Resources.GetMatch (.Params.featured_image.src | safeURL) }}
{{ if $featuredImage }}
{{ $featuredImage = $featuredImage.Resize "600x" }}
<figure class="article__featured-image">
<img alt="" src="{{ $featuredImage.RelPermalink }}" />
{{ with .Params.featured_image.caption }}
<figcaption>{{ . }}</figcaption>
{{ end }}
</figure>
{{ end }}
{{ end }}
{{ range .Params.tags }}
<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}">{{ . }}</a>
{{ end }}
<div>
{{ .Content }}
</div>
</article>
</main>
{{ end }}

View file

@ -0,0 +1,87 @@
{{ define "main" }}
<div class="root">
<div class="adhesion-container">
<div class="video-presentation video-presentation-cover" id="video-cover">
<div class="video-cover__back">
{{ partial "helpers/svg" (dict "path" "all_logos/square_notext_white_transparent" "class" "back-icon") }}
<!-- {{ partial "helpers/svg" (dict "path" "all_logos/horizontal_white_transparent" "class" "back-icon") }} -->
</div>
<div id="video-play-btn" class="video-cover__content">
<button>
{{ partial "helpers/svg" (dict "path" "icons/circle-play" "class" "btn-icon") }}
</button>
<p>Regarder le teaser</p>
</div>
</div>
<div class="video-presentation final-video-presentation" style="display: none;" id="final-video-container">
<!-- <!-1- <iframe -1-> -->
<!-- <!-1- title="Campagne d'adhésion 2023-2024 - L'étoile de Bethléem" -1-> -->
<!-- <!-1- width="100%" height="950" -1-> -->
<!-- <!-1- src="https://peertube.iriseden.eu/videos/embed/575e83c9-2dd5-464c-a31e-c2aae1bfd48b?p2p=0" -1-> -->
<!-- <!-1- frameborder="0" allowfullscreen="" sandbox="allow-same-origin allow-scripts allow-popups"> -1-> -->
<!-- <!-1- </iframe> -1-> -->
</div>
</div>
<div class="adhesion-footer">
<div class="page-container adhesion-btns">
<a
class="btn subscribe-button"
href="{{ .Site.Params.contact.helloasso_adhesion }}"
title="Adhérer sur Helloasso"
>
{{ partial "helpers/svg" (dict "path" "icons/helloasso" "class" "btn__icon") }}
Adhérer
</a>
<ul class="socials">
<li class="btn" title="Télécharger le bulletin d'adhésion papier">
<a href="{{ .Site.Params.contact.paper_adhesion }}">
{{ partial "helpers/svg" (dict "path" "icons/document" "class" "site-footer-socials__logo") }}
</a>
</li>
<li class="btn" title="Envoyer nous un e-mail">
<a href="mailto:{{ .Site.Params.contact.email }}">
{{ partial "helpers/svg" (dict "path" "icons/email" "class" "site-footer-socials__logo") }}
</a>
</li>
<li class="btn" title="Notre chaîne YouTube">
<a href="{{ .Site.Params.socials.youtube }}">
{{ partial "helpers/svg" (dict "path" "icons/youtube" "class" "site-footer-socials__logo") }}
</a>
</li>
<li class="btn" title="Notre groupe facebook">
<a href="{{ .Site.Params.socials.facebook }}">
{{ partial "helpers/svg" (dict "path" "icons/facebook" "class" "site-footer-socials__logo") }}
</a>
</li>
</ul>
</div>
</div>
</div>
<script>
let iframe_html = `<iframe
width="100%"
src="https://www.youtube.com/embed/vJeEqDfz_4c?autoplay=1"
title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen
></iframe>`;
let btn = document.getElementById("video-play-btn")
const video_cover = document.getElementById("video-cover")
const final_video_container = document.getElementById("final-video-container")
btn.onclick = () => {
video_cover.style.display = "none"
final_video_container.innerHTML = iframe_html
final_video_container.style.display = "block"
}
</script>
{{ end }}

View file

@ -0,0 +1,34 @@
{{ define "main" }}
<div class="team-presentation">
<div class="team-item">
</div>
</div>
<main class="page-container">
{{ $listtitle := .Title }}
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
<ul class="section-menu">
{{ range .Pages }}
<li>
<div class="post-title">
{{ if eq $listtitle "Posts" }}
{{ .Date.Format "2006-01-02" }} <a href="{{ .RelPermalink }}">{{.Title }}</a>
{{ else }}
<a href="{{ .RelPermalink }}">{{.Title }}</a>
{{ end }}
</div>
</li>
{{ end }}
</ul>
{{ if .Content }}
<div>
{{ with .Content }}<div>{{ . }}</div>{{ end }}
</div>
{{ end }}
</main>
{{ end }}

31
layouts/index.html Normal file
View file

@ -0,0 +1,31 @@
{{ define "main" }}
<div class="page-container">
<h1>Vélo et mobilités en Eure-Madrie-Seine</h1>
{{/*
{{ $image := resources.Get "images/velo_homme.jpg" }}
{{ $image = $image.Resize "400x" }}
<img
alt="Homme et un vélo"
src="{{ $image.RelPermalink }}"
/>
{{ $image := resources.Get "images/velo_femme.jpg" }}
{{ $image = $image.Resize "400x" }}
<img
alt="Une femme à vélo"
src="{{ $image.RelPermalink }}"
/>
*/}}
<div class="tmp_logo_container">
{{ $image := resources.Get "images/logos/logo.png" }}
<img
alt="Logo VMEMS représentant un vélo en transition"
src="{{ $image.RelPermalink }}"
/>
</div>
{{ .Content }}
</div>
{{ end }}

View file

@ -0,0 +1,36 @@
{{ $formattedDate := "" }}
{{ $rawDate := . }}
{{- $date := "1800-01-01" -}}
{{- $datePrecision := "day" -}}
{{ if reflect.IsMap $rawDate }}
{{ partial "FormatHistoricalDate" ($rawDate.from) }}
-
{{ partial "FormatHistoricalDate" ($rawDate.to) }}
{{ else }}
{{ $rawDate = string $rawDate }}
{{ if eq (len $rawDate) 4 }}
{{ $datePrecision = "year" }}
{{ $date = printf "%s-01-01" $rawDate }}
{{ end }}
{{ if eq (len $rawDate) 7 }}
{{ $datePrecision = "month" }}
{{ $date = printf "%s-01" $rawDate }}
{{ end }}
{{ if eq (len $rawDate) 10 }}
{{ $datePrecision = "day" }}
{{ $date = $rawDate }}
{{ end }}
{{- if eq $datePrecision "year" -}}
{{ $formattedDate = ($date | time.Format "2006") }}
{{- end -}}
{{- if eq $datePrecision "month" -}}
{{ $formattedDate = ($date | time.Format "January 2006") }}
{{- end -}}
{{- if eq $datePrecision "day" -}}
{{ $formattedDate = ($date | time.Format "2 January 2006") }}
{{- end -}}
{{ end }}
{{ printf "%s" $formattedDate }}

View file

@ -0,0 +1,13 @@
<!-- Use site subtitle by default -->
{{ $description := .Site.Params.sidebar.subtitle }}
{{ if .Description }}
<!-- Page description exists -->
{{ $description = .Description }}
{{ else if .IsPage }}
<!-- Use page summary -->
{{ $description = .Summary }}
{{ end }}
{{ return ($description | plainify)}}

View file

@ -0,0 +1,39 @@
{{- $title := .Title -}}
{{- $siteTitle := .Site.Title -}}
{{- if .IsHome -}}
<!-- Homepage, and it's pagination -->
<!-- Build paginator -->
{{ $pages := where .Site.RegularPages "Section" "in" .Site.Params.mainSections }}
{{ $notHidden := where .Site.RegularPages "Params.hidden" "!=" true }}
{{ $filtered := ($pages | intersect $notHidden) }}
{{ $pag := .Paginate ($filtered) }}
{{ if .Paginator.HasPrev }}
<!-- Paginated. Append page number to title -->
{{ $title = printf "%s - %s" .Paginator $siteTitle }}
{{ else }}
{{ $title = $siteTitle}}
{{ end }}
{{- else if eq .Kind "term" -}}
<!-- Taxonomy page -->
<!-- Build paginator -->
{{ $notHidden := where .Pages "Params.hidden" "!=" true }}
{{ $pag := .Paginate ($notHidden) }}
<!-- {TAXONOMY_TYPE}: {TAXONOMY_TERM} -->
{{ $title = slice (title .Data.Singular) ": " $title }}
{{ if .Paginator.HasPrev }}
<!-- Add page number-->
{{ $title = $title | append " - " .Paginator }}
{{ end }}
{{ $title = $title | append " - " $siteTitle }}
{{ $title = delimit $title "" }}
{{- end -}}
{{ return $title }}

View file

@ -0,0 +1,2 @@
<footer class="site-footer">
</footer>

View file

@ -0,0 +1,4 @@
{{- $a := index . 0 -}}
{{- $b := index . 1 -}}
{{- $c := mod $a $b -}}
{{- if lt $c 0 -}}{{- add $c $b -}}{{- else -}}{{- $c -}}{{- end -}}

View file

@ -0,0 +1,44 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{- $description := partialCached "data/description" . .RelPermalink -}}
<meta name="description" content="{{ $description }}">
{{- with .Site.Params.author -}}
<meta name="author" content="{{ . }}">
{{ end }}
{{- $title := partialCached "data/title" . .RelPermalink -}}
<title>{{ $title }} {{ if not .IsHome }}- L'Étoile de Bethléem{{ end }}</title>
<link rel="canonical" href="{{ .Permalink }}">
{{ partial "opengraph/include.html" . }}
{{ range .AlternativeOutputFormats }}
<link rel="{{ .Rel }}" type="{{ .MediaType.Type }}" href="{{ .Permalink | safeURL }}">
{{ end }}
<link rel="apple-touch-icon" sizes="57x57" href="/icons/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/icons/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/icons/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/icons/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/icons/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/icons/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/icons/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/icons/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/icons/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/icons/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/icons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/icons/favicon-16x16.png">
<link rel="manifest" href="/manifest.json">
<meta name="msapplication-TileColor" content="#025E73">
<meta name="msapplication-TileImage" content="/icons/ms-icon-144x144.png">
<meta name="theme-color" content="#025E73">
<!-- Note: j'ai galérer à rajouter du scss car en fait y'avait déja une variable $style de définit plus haut... -->
{{ $style := resources.Get "sass/main.scss" | resources.ToCSS | resources.Fingerprint }}
<link rel="stylesheet" href="{{ $style.Permalink }}" integrity="{{ $style.Data.Integrity }}">

View file

@ -0,0 +1,2 @@
<header class="site-header">
</header>

View file

@ -0,0 +1,60 @@
<!-- Modified to have the featured image field as a dict (being able to specify meta data and display option for image) -->
{{ $result := dict "exists" false "permalink" nil "resource" nil "isDefault" false }}
{{ $imageField := "featured_image" }}
{{ $imageValue := index .Context.Params $imageField }}
{{ if $imageValue }}
{{ $imageValue := index $imageValue "src" }}
<!-- If page has `image` field set -->
{{ $result = merge $result (dict "exists" true) }}
{{ $url := urls.Parse $imageValue }}
{{ if or (eq $url.Scheme "http") (eq $url.Scheme "https") }}
<!-- Is an external image -->
{{ $result = merge $result (dict "permalink" $imageValue) }}
{{ else }}
{{ $pageResourceImage := resources.GetMatch (printf "%s" ($imageValue | safeURL)) }}
{{ if $pageResourceImage }}
<!-- If image is found under page bundle -->
{{ $result = merge $result (dict "permalink" $pageResourceImage.RelPermalink) }}
<!-- Disable SVG image processing, not supported by Hugo -->
{{ if ne (path.Ext $imageValue) ".svg" }}
{{ $result = merge $result (dict "resource" $pageResourceImage) }}
{{ end }}
{{ else }}
<!-- Can not find the image under page bundle. Could be a relative linked image -->
{{ $result = merge $result (dict "permalink" (relURL $imageValue)) }}
{{ end }}
{{ end }}
{{ else }}
<!-- Type arg is set, check for defaultImage setting -->
{{ $defaultImageSetting := .Context.Site.Params.defaultCoverImage }}
{{ $result = merge $result (dict "isDefault" true) }}
{{ $result = merge $result (dict "exists" true) }}
{{ if $defaultImageSetting.local }}
{{ $siteResourceImage := resources.GetMatch (printf "%s" ($defaultImageSetting.src | safeURL)) }}
{{ if $siteResourceImage }}
<!-- Try search image under site's assets folder -->
{{ $result = merge $result (dict "permalink" $siteResourceImage.RelPermalink) }}
{{ $result = merge $result (dict "resource" $siteResourceImage) }}
{{ else }}
<!-- Can not find the image -->
{{ errorf "Failed loading image: %q" $defaultImageSetting.src }}
{{ $result = merge $result (dict "exists" false) }}
{{ end }}
{{ else }}
<!-- External image -->
{{ $result = merge $result (dict "permalink" (relURL $defaultImageSetting.src)) }}
{{ end }}
{{ end }}
{{ return $result }}

View file

@ -0,0 +1,7 @@
{{ $svg := .path }}
{{ $match := `<svg((\s|\S)*)>((\s|\S)*)</svg>` }}
{{ $input := (printf "/assets/images/%s.svg" $svg | readFile) }}
{{ $replaceWith := printf `<svg class="%s" ${1}>${2}</svg>` .class }}
{{ return (replaceRE $match $replaceWith $input | safeHTML) }}

View file

@ -0,0 +1,54 @@
<div class="gallery">
<div class="gallery__side">
{{ $listtitle := .Title }}
{{ if or .Title .Content }}
<div>
{{ with .Title }}<h1>{{ . }}</h1>{{ end }}
{{ with .Content }}<div>{{ . }}</div>{{ end }}
</div>
{{ end }}
<p class="gallery-tags__title">Filtrer par étiquettes :</p>
<ul class="gallery-tags__list tags-list">
{{- if eq (.Scratch.Get "image_list_context") "imtags" -}}
<li class="gallery-tags__item tags-list__item">
<a href="/images">Tout</a>
</li>
{{- end -}}
{{- range .Site.Taxonomies.imtags -}}
<li class="gallery-tags__item tags-list__item">
<a href="{{ .Page.RelPermalink }}">{{ .Page.Title }}</a>
</li>
{{- end -}}
</ul>
</div>
<div class="gallery__items-container">
<div class="gallery__items">
{{ range $item := (.Paginator 8).Pages }}
<a class="gallery__item" href="{{ .RelPermalink }}">
{{ $image := .Resources.GetMatch "original.jpg" }}
{{ $image := $image.Resize "x350" }}
{{ with $image }}
<img
class="gallery__image"
title="{{ $item.Title }}"
src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}"
/>
{{ end }}
{{/*
<div class="post-title">
{{ if eq $listtitle "Posts" }}
{{ .Date.Format "2006-01-02" }} <a href="{{ .RelPermalink }}">{{.Title }}</a>
{{ else }}
<a href="{{ .RelPermalink }}">{{.Title }}</a>
{{ end }}
</div>
*/}}
</a>
{{ end }}
</div>
{{ partial "pagination.html" . }}
</div>
</div>

View file

@ -0,0 +1,44 @@
{{- $title := partialCached "data/title" . .RelPermalink -}}
{{- $description := partialCached "data/description" . .RelPermalink -}}
{{/* OpenGraph protocol reference https://ogp.me/ */}}
<meta property="og:title" content="{{ $title }}">
<meta property="og:description" content="{{ $description }}">
<meta property="og:url" content="{{ .Permalink }}">
<meta property="og:site_name" content="{{ .Site.Title }}">
<meta property="og:type" content="
{{- if .IsPage -}}
article
{{- else -}}
website
{{- end -}}
">
<meta property="og:locale" content="{{ .Site.LanguageCode }}">
{{- if .IsPage -}}
<meta property="article:section" content="{{ .Section | title }}" />
{{- range .Params.tags -}}
<meta property="article:tag" content="{{ . }}" />
{{- end -}}
{{- end -}}
{{- if .IsPage -}}
{{- 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 .Site.LastChange.IsZero }}
<meta property="og:updated_time" content="{{- .Site.LastChange.Format "2006-01-02T15:04:05-07:00" | safeHTML -}}" />
{{- end -}}
{{- end -}}
{{ $image := partial "helpers/image" (dict "Context" . "Type" "opengraph") .RelPermalink "opengraph" }}
{{ if $image.exists }}
<meta property="og:image" content="{{ absURL $image.permalink }}" />
{{- end -}}

View file

@ -0,0 +1,19 @@
<div class="pagination-nav">
<div>
{{ if .Paginator.HasPrev }}
<a class="pagination-nav__prev" href="{{ .Paginator.Prev.URL }}">
Page précédente
</a>
{{ end }}
</div>
<div class="pagination-nav__page">
{{ .Paginator.PageNumber }} de {{ .Paginator.TotalPages }}
</div>
<div>
{{ if .Paginator.HasNext }}
<a class="pagination-nav__next" href="{{ .Paginator.Next.URL }}">
Page suivante
</a>
{{ end }}
</div>
</div>

View file

@ -0,0 +1,14 @@
<aside>
<div>
<div>
<h3>LATEST POSTS</h3>
</div>
<div>
<ul>
{{ range first 5 (where .Site.RegularPages "Type" "in" .Site.Params.mainSections) }}
<li><a href="{{ .RelPermalink }}">{{ .Title }}</a></li>
{{ end }}
</ul>
</div>
</div>
</aside>

View file

@ -0,0 +1,9 @@
{{ define "main" }}
<h1>Sandbox 1</h1>
<pre>
{{ mod -1 2 }}
{{ partial "fullmod" (slice -1 5) }}
</pre>
{{ end }}

View file

@ -0,0 +1,6 @@
<figure>
{{ $img_src := .Get "src" }}
{{ $description := .Get "description" }}
<img alt="{{ $description }}" src="{{ $img_src }}" />
<figcaption>{{ $description }}</figcaption>
</figure>

View file

@ -0,0 +1,30 @@
<figure class="fig-img {{ with .Get "class" }}{{ . }}{{ end }}">
{{- if .Get "link" -}}
<a href="{{ .Get "link" }}"{{ with .Get "target" }} target="{{ . }}"{{ end }}{{ with .Get "rel" }} rel="{{ . }}"{{ end }}>
{{- end -}}
{{ $options := .Get "options" }}
{{ $img := (.Page.Resources.GetMatch (.Get "src")).Fit $options }}
<img src="{{ $img.RelPermalink }}"
{{- if or (.Get "alt") (.Get "caption") }}
alt="{{ with .Get "alt" }}{{ . }}{{ else }}{{ .Get "caption" | markdownify| plainify }}{{ end }}"
{{- end -}}
/><!-- Closing img tag -->
{{- if .Get "link" }}</a>{{ end -}}
{{- if or (or (.Get "title") (.Get "caption")) (.Get "attr") -}}
<figcaption>
{{ with (.Get "title") -}}
<h4>{{ . }}</h4>
{{- end -}}
{{- if or (.Get "caption") (.Get "attr") -}}<p>
{{- .Get "caption" | markdownify -}}
{{- with .Get "attrlink" }}
<a href="{{ . }}">
{{- end -}}
{{- .Get "attr" | markdownify -}}
{{- if .Get "attrlink" }}</a>{{ end }}</p>
{{- end }}
</figcaption>
{{- end }}
</figure>

View file

@ -0,0 +1,2 @@
{{ $c := mod (.Get 0) (.Get 1) }}
{{ if lt $c 0 }}{{ add (.Get 1) $c }}{{ else }}{{ $c }}{{ end }}

View file

@ -0,0 +1,8 @@
{{ $link := printf "https://%s.wikipedia.org/wiki/%s" (.Get "lang") (.Get "name") }}
<a href="{{ $link }}" class="btn wikipedia-btn" title="Voir l'article &quot;{{.Get "name"}}&quot; sur Wikipedia">
{{ partial "helpers/svg" (dict "path" "icons/wikipedia_globe" "class" "btn__icon") }}
<div>Voir l'article sur Wikipedia
{{ partial "helpers/svg" (dict "path" "icons/external" "class" "icon_inline") }}
</div>
</a>