7
1
mirror of https://gitlab.com/ansol/web-ansol.org.git synced 2024-11-21 22:01:31 +00:00

Add self-hosted fonts and open graph info

This commit is contained in:
Hugo Peixoto 2021-11-01 01:15:28 +00:00
parent 58e78c8772
commit f5c9599a98
41 changed files with 441 additions and 183 deletions

28
assets/files Normal file
View File

@ -0,0 +1,28 @@
https://fonts.gstatic.com/s/roboto/v29/KFOkCnqEu92Fr1MmgVxFIzIFKw.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOkCnqEu92Fr1MmgVxMIzIFKw.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOkCnqEu92Fr1MmgVxEIzIFKw.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOkCnqEu92Fr1MmgVxLIzIFKw.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOkCnqEu92Fr1MmgVxHIzIFKw.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOkCnqEu92Fr1MmgVxGIzIFKw.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOkCnqEu92Fr1MmgVxIIzI.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmSU5fBBc4.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOmCnqEu92Fr1Mu72xKOzY.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOmCnqEu92Fr1Mu5mxKOzY.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOmCnqEu92Fr1Mu7mxKOzY.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOmCnqEu92Fr1Mu4WxKOzY.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOmCnqEu92Fr1Mu7WxKOzY.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOmCnqEu92Fr1Mu7GxKOzY.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOmCnqEu92Fr1Mu4mxK.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2
https://fonts.gstatic.com/s/roboto/v29/KFOlCnqEu92Fr1MmWUlfBBc4.woff2

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -124,7 +124,7 @@ contact_links = [
############################ ############################
# Default image for social sharing and search engines. Place image in `static/img/` folder and specify image name here. # Default image for social sharing and search engines. Place image in `static/img/` folder and specify image name here.
sharing_image = "logo-placeholder.png" sharing_image = "sharing-image.png"
# Twitter username (without @). Used when a visitor shares your site on Twitter. # Twitter username (without @). Used when a visitor shares your site on Twitter.
twitter = "ansol" twitter = "ansol"

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -327,5 +327,3 @@ article.article h1 {
font-weight: 300; font-weight: 300;
line-height: 2.5rem; line-height: 2.5rem;
} }

View File

@ -0,0 +1,256 @@
:root {
--font-display: swap;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
font-display: var(--font-display);
src: url({{ (resources.Get "fonts/KFOkCnqEu92Fr1MmgVxFIzIFKw.woff2").Permalink }}) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
font-display: var(--font-display);
src: url(/fonts/KFOkCnqEu92Fr1MmgVxMIzIFKw.woff2) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
font-display: var(--font-display);
src: url(/fonts/KFOkCnqEu92Fr1MmgVxEIzIFKw.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
font-display: var(--font-display);
src: url(/fonts/KFOkCnqEu92Fr1MmgVxLIzIFKw.woff2) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOkCnqEu92Fr1MmgVxHIzIFKw.woff2").Permalink }}) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOkCnqEu92Fr1MmgVxGIzIFKw.woff2").Permalink }}) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 100;
font-display: var(--font-display);
src: url({{ (resources.Get "fonts/KFOkCnqEu92Fr1MmgVxIIzI.woff2").Permalink }}) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 300;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmSU5fBBc4.woff2").Permalink }}) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOmCnqEu92Fr1Mu72xKOzY.woff2").Permalink }}) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: var(--font-display);
src: url({{ (resources.Get "/fonts/KFOmCnqEu92Fr1Mu5mxKOzY.woff2").Permalink }}) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOmCnqEu92Fr1Mu7mxKOzY.woff2").Permalink }}) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOmCnqEu92Fr1Mu4WxKOzY.woff2").Permalink }}) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOmCnqEu92Fr1Mu7WxKOzY.woff2").Permalink }}) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOmCnqEu92Fr1Mu7GxKOzY.woff2").Permalink }}) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 400;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOmCnqEu92Fr1Mu4mxK.woff2").Permalink }}) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0370-03FF;
}
/* vietnamese */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2").Permalink }}) format('woff2');
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: 'Roboto';
font-style: normal;
font-weight: 700;
font-display: swap;
src: url({{ (resources.Get "/fonts/KFOlCnqEu92Fr1MmWUlfBBc4.woff2").Permalink }}) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

View File

@ -60,15 +60,6 @@
version = "8.4.8" version = "8.4.8"
sri = "sha256-lyWCDMnMeZiXRi7Zl54sZGKYmgQs4izcT7+tKc+KUBk=" sri = "sha256-lyWCDMnMeZiXRi7Zl54sZGKYmgQs4izcT7+tKc+KUBk="
url = "https://cdnjs.cloudflare.com/ajax/libs/mermaid/%s/mermaid.min.js" url = "https://cdnjs.cloudflare.com/ajax/libs/mermaid/%s/mermaid.min.js"
[js.lazysizes]
version = "5.1.2"
sri = "sha256-Md1qLToewPeKjfAHU1zyPwOutccPAm5tahnaw7Osw0A="
url = "https://cdnjs.cloudflare.com/ajax/libs/lazysizes/%s/lazysizes.min.js"
async = true
[js.cookieconsent]
version = "3.1.1"
sri = "sha256-5VhCqFam2Cn+yjw61zbBNrbHVJ6SRydPeKopYlngbiQ="
url = "https://cdnjs.cloudflare.com/ajax/libs/cookieconsent2/%s/cookieconsent.min.js"
# CSS # CSS

View File

@ -0,0 +1,53 @@
{{- define "main" -}}
{{ $image := (.Resources.ByType "image").GetMatch "*cover*" }}
<article class="article">
<h1>{{ .Title }}</h1>
{{ if $image }}
<img src="{{ $image.RelPermalink }}" alt="" class="featured-image" style="max-width: 100px;">
{{ end }}
<div class="article-container">
<div class="article-style">
{{ .Content }}
{{ if eq .Params.layout "evento" }}
<h3>Informação do evento</h3>
{{ with .Params.metadata.event.date }}
<p>
<strong>Data:</strong>
{{ if eq (time.Format "2 January 2006" .start) (time.Format "2 January 2006" .finish) }}
{{ if eq (time.Format "15:04" .start) (time.Format "15:04" .finish) }}
{{ time.Format "2 de January de 2006" .start }}
{{ else }}
{{ time.Format "2 de January de 2006" .start }} das
{{ time.Format "15:04" .start }} às
{{ time.Format "15:04" .finish }}
{{ end }}
{{ else if eq (time.Format "January 2006" .start) (time.Format "January 2006" .finish) }}
De {{ time.Format "2" .start }} a {{ time.Format "2 de January de 2006" .finish }}
{{ else }}
De {{ time.Format "2 de January de 2006" .start }} até {{ time.Format "2 de January de 2006" .finish }}
{{ end }}
</p>
{{ end }}
{{ with .Params.metadata.event.site }}
<p><strong>Website:</strong> <a href="{{ .url }}">{{ .title | or .url }}</a></p>
{{ end }}
{{ with .Params.metadata.event.location }}
<p><strong>Local:</strong> {{ . }}</p>
{{ end }}
{{ end }}
</div>
{{ partial "page_footer" . }}
</div>
</article>
{{- end -}}

View File

@ -17,17 +17,16 @@
<section class='news-section'> <section class='news-section'>
<h2 class="pull-header body-width">Notícias</h2> <h2 class="pull-header body-width">Notícias</h2>
<ul class='news-list body-width'> <ul class='news-list body-width'>
{{ $query := where site.RegularPages "Type" "noticias" }} {{ $query := where site.RegularPages "Type" "noticias" -}}
{{ $news := site.GetPage "categories/noticia" }} {{ $news := site.GetPage "categories/noticia" -}}
{{ $query = $query | intersect $news.Pages }} {{ $query = $query | intersect $news.Pages -}}
{{ $query = first 3 $query }} {{ $query = first 3 $query -}}
{{ range $post := $query -}}
{{ range $post := $query }}
<li> <li>
<a class='cover' href="{{ .Permalink }}"> <a class='cover' href="{{ .Permalink }}">
{{ range (first 1 (.Resources.ByType "image")) }} {{ range (first 1 (.Resources.ByType "image")) -}}
<img class='news-cover' src="{{ .Permalink }}" /> <img class='news-cover' src="{{ .Permalink }}" />
{{ end }} {{ end -}}
</a> </a>
<div class='text'> <div class='text'>

View File

@ -1,4 +0,0 @@
{{/* Do not directly modify this file! */}}
{{/* Instead, create a `layouts/partials/custom_head.html` file in your site and add your code to it. */}}
{{/* This partial is included in `themes/academic/layouts/partials/site_head.html`. */}}

View File

@ -1,23 +1,16 @@
{{ $page := .page }} {{- $page := .page -}}
{{ $summary := .summary }} {{- $summary := .summary -}}
{{ $site_type := site.Params.site_type | default "Person" }} {{- $site_type := site.Params.site_type | default "Person" -}}
{{- if $page.IsHome -}} {{- if $page.IsHome -}}
{{- partial "jsonld/website.html" $page -}}
{{ partial "jsonld/website.html" $page }} {{- if ne $site_type "Person" -}}
{{- partial "jsonld/business.html" $page -}}
{{ if ne $site_type "Person" }} {{- end -}}
{{ partial "jsonld/business.html" $page }}
{{ end }}
{{- else if $page.IsPage -}} {{- else if $page.IsPage -}}
{{ if (eq $page.Type "post") | or (eq $page.Type "publication") | or (eq $page.Type "project") }} {{ if (eq $page.Type "post") | or (eq $page.Type "publication") | or (eq $page.Type "project") }}
{{ partial "jsonld/article.html" (dict "page" $page "summary" $summary) }} {{ partial "jsonld/article.html" (dict "page" $page "summary" $summary) }}
{{ end }} {{ end }}
{{ if eq $page.Type "talk" }} {{ if eq $page.Type "talk" }}
{{ partial "jsonld/event.html" (dict "page" $page "summary" $summary) }} {{ partial "jsonld/event.html" (dict "page" $page "summary" $summary) }}
{{ end }} {{ end }}
{{- end -}}
{{- end }}

View File

@ -0,0 +1,47 @@
{{- $scr := .Scratch -}}
{{- $featured_image := (.Resources.ByType "image").GetMatch "*cover*" -}}
{{- $avatar_image := (.Resources.ByType "image").GetMatch "avatar*" -}}
{{- $has_logo := fileExists "assets/images/logo.png" | or (fileExists "assets/images/logo.svg") -}}
{{- $og_image := "" -}}
{{- $twitter_card := "summary_large_image" -}}
{{- if (and (eq .Kind "taxonomy") $avatar_image) -}}
{{- $og_image = ($avatar_image.Fill "270x270 Center").Permalink -}}
{{- $twitter_card = "summary" -}}
{{- else if $featured_image -}}
{{- $og_image = $featured_image.Permalink -}}
{{- else if .Params.header.image -}}
{{- $og_image = printf "images/%s" .Params.header.image | absURL -}}
{{- else if site.Params.sharing_image -}}
{{- $og_image = printf "images/%s" site.Params.sharing_image | absURL -}}
{{- else if $has_logo -}}
{{- $og_image = (partial "functions/get_logo" (dict "constraint" "fit" "size" 300)).Permalink -}}
{{- $twitter_card = "summary" -}}
{{- else -}}
{{- $og_image = (partial "functions/get_icon" 512).Permalink -}}
{{- $twitter_card = "summary" -}}
{{- end -}}
{{- $scr.Set "og_image" $og_image -}}
<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="{{ $scr.Get "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 -}}

View File

@ -5,107 +5,66 @@
<meta name="author" content="ANSOL - Associação Nacional para o Software Livre"> <meta name="author" content="ANSOL - Associação Nacional para o Software Livre">
{{ $scr := .Scratch }} {{ $scr := .Scratch -}}
{{/* Generate page description. */}} {{ $desc := "" -}}
{{ $desc := "" }} {{ if .Params.summary -}}
{{ if .Params.summary }} {{ $desc = .Params.summary -}}
{{ $desc = .Params.summary }} {{ else if .Params.abstract -}}
{{ else if .Params.abstract }} {{ $desc = .Params.abstract -}}
{{ $desc = .Params.abstract }} {{ else if .IsPage -}}
{{ else if .IsPage }} {{ $desc = .Summary -}}
{{ $desc = .Summary }} {{ else if site.Params.description -}}
{{ else if site.Params.description }} {{ $desc = site.Params.description -}}
{{ $desc = site.Params.description }} {{ end -}}
{{ end }} {{ .Scratch.Set "desc" $desc -}}
<meta name="description" content="{{ $desc }}"> <meta name="description" content="{{ $desc }}">
{{ partial "functions/parse_theme" . }} {{ partial "functions/parse_theme" . -}}
{{ $css := site.Data.assets.css }} {{ $css := site.Data.assets.css -}}
{{ $js := site.Data.assets.js }} {{ $js := site.Data.assets.js -}}
{{ if ne ($scr.Get "primary") "#fff" }} {{ if ne ($scr.Get "primary") "#fff" }}
<meta name="theme-color" content="{{ $scr.Get "primary" }}"> <meta name="theme-color" content="{{ $scr.Get "primary" }}">
{{ end }} {{ end -}}
{{/* Config LaTeX math rendering. */}} {{ if or .Params.math site.Params.math -}}
{{ if or .Params.math site.Params.math }} {{ $mathjax_config := resources.Get "js/mathjax-config.js" -}}
{{ $mathjax_config := resources.Get "js/mathjax-config.js" }}
<script src="{{ $mathjax_config.RelPermalink }}"></script> <script src="{{ $mathjax_config.RelPermalink }}"></script>
{{ end }} {{ end -}}
{{ $scr.Set "highlight_enabled" true }} {{ if or (eq site.Params.map.engine 2) (eq site.Params.map.engine 3) -}}
{{ if isset .Params "highlight" }} {{/* printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.leaflet.url $css.leaflet.version) $css.leaflet.sri | safeHTML */}}
{{ $scr.Set "highlight_enabled" .Params.highlight }} {{ end -}}
{{ 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.engine 2) (eq site.Params.map.engine 3) }} {{ if eq site.Params.search.engine 2 -}}
{{ 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.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 }} {{ printf "<link rel=\"stylesheet\" href=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\">" (printf $css.instantsearchTheme.url $css.instantsearchTheme.version) $css.instantsearchTheme.sri | safeHTML }}
{{ end }} {{ end -}}
{{/* Load async scripts. */}} {{ $css_options := dict "targetPath" "css/ansol.css" -}}
{{ range $k, $v := site.Data.assets.js }}{{/* TODO: investigate why `where ... "async" true` does not work. */}}
{{ $load := $v.async }}
{{/* Only load MathJax if required. */}}
{{ if (eq $k "mathJax") | and (not (or $.Params.math site.Params.math)) }}
{{ $load = false }}
{{end}}
{{ if $load }}
{{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\" async></script>" (printf $v.url $v.version) $v.sri | safeHTML }}
{{end}}
{{end}}
{{/* We cannot use SRI with Google Fonts because the CSS is dynamically generated according to the user agent. */}}
{{/* Hugo's htmlEscape cannot escape "|" in Google Font URIs so we implement our own escape functionality. */}}
{{ with ($scr.Get "google_fonts") }}
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:400,700%7CRoboto:100,300,400,400italic,700%7CRoboto+Mono&amp;display=swap">
<link rel="stylesheet" {{ printf "href=\"https://fonts.googleapis.com/css?family=%s&display=swap\"" . | replaceRE "\\|" "%7C" | safeHTMLAttr }}>
{{ end }}
{{ $css_options := dict "targetPath" "css/academic.css" }}
{{- if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") -}} {{- if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") -}}
{{- $css_options = merge $css_options (dict "outputStyle" "compressed") -}} {{- $css_options = merge $css_options (dict "outputStyle" "compressed") -}}
{{- end -}} {{- end -}}
{{ $sass_template := resources.Get "scss/ansol.scss" }} {{ $sass_template := resources.Get "scss/ansol.scss" -}}
{{ $style := $sass_template | resources.ExecuteAsTemplate "ansol_parsed.scss" . | toCSS $css_options }} {{ $style := $sass_template | resources.ExecuteAsTemplate "ansol_parsed.scss" . | toCSS $css_options -}}
{{- if (eq (getenv "HUGO_ENV") "production") -}} {{- if (eq (getenv "HUGO_ENV") "production") -}}
{{- $style = $style | minify | fingerprint "md5" -}} {{- $style = $style | minify | fingerprint "md5" -}}
{{- end -}} {{- end -}}
<link rel="stylesheet" href="{{ $style.RelPermalink }}"> <link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{ partial "marketing/google_analytics" . }} {{ $css_options := dict "targetPath" "css/fonts.css" -}}
{{ partial "marketing/google_tag_manager" . }} {{- if (in (slice (getenv "HUGO_ENV") hugo.Environment) "production") -}}
{{- $css_options = merge $css_options (dict "outputStyle" "compressed") -}}
{{- end -}}
{{ $sass_template := resources.Get "scss/fonts.scss" -}}
{{ $style := $sass_template | resources.ExecuteAsTemplate "ansol_parsed.scss" . | toCSS $css_options -}}
{{- if (eq (getenv "HUGO_ENV") "production") -}}
{{- $style = $style | minify | fingerprint "md5" -}}
{{- end -}}
<link rel="stylesheet" href="{{ $style.RelPermalink }}">
{{/* Netlify Identity integration. */}} {{ with .OutputFormats.Get "RSS" -}}
{{ if .IsHome | and (site.Params.cms.netlify_cms | default true) }}
<script src="https://identity.netlify.com/v1/netlify-identity-widget.js"></script>
{{ end }}
{{ with .OutputFormats.Get "RSS" }}
<link rel="alternate" href="{{.RelPermalink}}" type="application/rss+xml" title="{{site.Title}}"> <link rel="alternate" href="{{.RelPermalink}}" type="application/rss+xml" title="{{site.Title}}">
{{ end }} {{ end -}}
<link rel="manifest" href="{{ "index.webmanifest" | relLangURL }}"> <link rel="manifest" href="{{ "index.webmanifest" | relLangURL }}">
<link rel="icon" type="image/png" href="{{(partial "functions/get_icon" 32).RelPermalink}}"> <link rel="icon" type="image/png" href="{{(partial "functions/get_icon" 32).RelPermalink}}">
@ -113,60 +72,11 @@
<link rel="canonical" href="{{ .Permalink }}"> <link rel="canonical" href="{{ .Permalink }}">
{{/* Get page image for sharing. */}} {{ partial "open_graph" . }}
{{ $featured_image := (.Resources.ByType "image").GetMatch "*featured*" }}
{{ $avatar_image := (.Resources.ByType "image").GetMatch "avatar*" }}
{{ $has_logo := fileExists "assets/images/logo.png" | or (fileExists "assets/images/logo.svg") }}
{{ $og_image := "" }}
{{ $twitter_card := "summary_large_image" }}
{{ if (and (eq .Kind "taxonomy") $avatar_image) }}
{{ $og_image = ($avatar_image.Fill "270x270 Center").Permalink }}{{/* Match image proc in About widget. */}}
{{ $twitter_card = "summary" }}
{{ else 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 $has_logo }}
{{ $og_image = (partial "functions/get_logo" (dict "constraint" "fit" "size" 300)).Permalink }}
{{ $twitter_card = "summary" }}
{{ else }}
{{ $og_image = (partial "functions/get_icon" 512).Permalink }}
{{ $twitter_card = "summary" }}
{{ end }}
{{ $scr.Set "og_image" $og_image }}{{/* Set `og_image` globally for `rss.xml`. */}}
<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 "jsonld/main" (dict "page" . "summary" $desc) }} {{ partial "jsonld/main" (dict "page" . "summary" $desc) }}
{{ partial "cookie_consent" . }}
{{ partial "custom_head" . }} {{ partial "custom_head" . }}
<title>{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ site.Title }}</title> <title>{{ if not .IsHome }}{{ .Title }} | {{ end }}{{ site.Title }}</title>
</head> </head>

View File

@ -1,21 +1,8 @@
{{ $scr := $.Scratch }} {{ $scr := $.Scratch -}}
{{/* Attempt to load local vendor JS, otherwise load from CDN. */}} {{/* Attempt to load local vendor JS, otherwise load from CDN. */}}
{{ $js := site.Data.assets.js }} {{ $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 }}
{{ 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="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/{{ $v }}/languages/{{ . }}.min.js"></script>
{{ end }}
{{ end }}
{{ end }}
{{/* Maps JS. */}} {{/* Maps JS. */}}
{{ if and (or (eq site.Params.map.engine 2) (eq site.Params.map.engine 3)) ($scr.Get "use_cdn") }} {{ if and (or (eq site.Params.map.engine 2) (eq site.Params.map.engine 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 }} {{ printf "<script src=\"%s\" integrity=\"%s\" crossorigin=\"anonymous\"></script>" (printf $js.leaflet.url $js.leaflet.version) $js.leaflet.sri | safeHTML }}