Add theme layouts

This commit is contained in:
Alexandre Iooss 2021-11-01 12:16:20 +01:00
parent 1a8a3d0709
commit 86ac613791
2 changed files with 122 additions and 0 deletions

View file

@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="{{ .Site.LanguageCode }}">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ block "title" . }}{{ .Page.Title }} - {{ .Site.Title }}{{ end }}</title>
<link rel="icon" type="image/png" href="{{ "favicon.png" | relURL }}">
<!-- Keywords -->
{{ if .Keywords }}
<meta name="keywords" content="{{ delimit .Keywords ", " }}">
{{ else if .Site.Params.DefaultKeywords }}
<meta name="keywords" content="{{ delimit .Site.Params.DefaultKeywords ", " }}">
{{ end }}
<!-- Description -->
{{ if .Description }}
<meta name="description" content="{{ .Description }}">
{{ else if .Site.Params.DefaultDescription }}
<meta name="description" content="{{ .Site.Params.DefaultDescription }}">
{{ end }}
<!-- Some other meta -->
{{ hugo.Generator }}
{{ template "_internal/opengraph.html" . }}
<link rel="alternate" href="{{ "/index.xml" | absURL }}" type="application/rss+xml" title="{{ .Site.Title }}">
<!-- CSS -->
{{- if .Site.IsServer }}
{{- $cssOpts := (dict "enableSourceMap" true) }}
{{- $css := resources.Get "style.scss" | toCSS $cssOpts }}
<link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}">
{{- else }}
{{- $cssOpts := (dict "outputStyle" "compressed") }}
{{- $css := resources.Get "style.scss" | toCSS $cssOpts | minify | fingerprint }}
<link rel="stylesheet" type="text/css" href="{{ $css.RelPermalink }}" integrity="{{ $css.Data.Integrity }}">
{{- end }}
</head>
<body>
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="container">
<div class="navbar-brand">
<a class="navbar-item" href="{{ "/" | relLangURL }}">
<img src="{{ printf "/images/%s" .Site.Params.navbarlogo.image | relURL }}" alt="" width="112" height="28">
</a>
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbar-menu">
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
<span aria-hidden="true"></span>
</a>
</div>
<div id="navbar-menu" class="navbar-menu is-fixed">
<div class="navbar-end">
{{- range .Site.Menus.main }}
<a href="{{ .URL }}" class="navbar-item">
{{ .Name }}
</a>
{{- end }}
<!-- Translations -->
{{ range $.Page.Translations }}
<a href="{{ .Permalink }}" class="navbar-item">{{ .Language.LanguageName }}</a>
{{ end }}
<!-- Search -->
<div class="navbar-item control">
<input class="input is-small has-background-grey-darker" id="autoComplete" type="search"
placeholder="{{ i18n "search" }}">
</div>
</div>
</div>
</div>
</nav>
{{ block "main" . }}{{ end }}
<footer class="footer footer-dark">
<div class="content has-text-centered">
<span>&copy; {{ now.Year }} Aurore</span>
<span>&middot;</span>
<span><a href="https://gitea.auro.re/aurore/homepage" target="_blank">{{ i18n "source_code" }}</a></span>
</div>
</footer>
<script type="text/javascript" src="{{ "js/autoComplete.min.js" | relURL }}"></script>
<script type="text/javascript">
const indexUrl = "{{ "index.json" | absLangURL }}";
</script>
<script type="text/javascript" src="{{ "js/search.js" | relURL }}"></script>
<script type="text/javascript" src="{{ "js/navbar.js" | relURL }}"></script>
</body>
</html>

View file

@ -0,0 +1,24 @@
{{ define "main" }}
<section class="section">
<div class="container">
<div class="columns">
<div class="column is-centered-tablet-portrait">
<h1 class="title section-title">{{ .Title }}</h1>
<h5 class="subtitle is-5 is-muted">{{ .Params.Subtitle }}</h5>
<div class="divider"></div>
</div>
</div>
{{ if (.Params.toc) }}
<div class="box">
<div class="content is-size-6">
<h5>{{ i18n "table_of_contents" }}</h5>
{{ .TableOfContents }}
</div>
</div>
{{ end }}
<div class="content is-size-5">
{{ .Content }}
</div>
</div>
</section>
{{ end }}