Adiciona arquivos anuais, mensais e diários

This commit is contained in:
Hugo Peixoto 2023-07-19 11:07:37 +01:00
parent 978b403bac
commit 0e5250a897
8 changed files with 105 additions and 1 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/content/archd
/content/archm
/content/archy

View File

@ -11,3 +11,6 @@ unsafe= true
[permalinks] [permalinks]
[permalinks.page] [permalinks.page]
artigos = "/:year/:month/:day/:filename" artigos = "/:year/:month/:day/:filename"
archd = "/:year/:month/:day/"
archm = "/:year/:month/"
archy = "/:year/"

View File

@ -55,7 +55,7 @@
<ul> <ul>
{{ range ($articles.GroupByDate "2006-01") }} {{ range ($articles.GroupByDate "2006-01") }}
<li><a href="">{{ time.Format "January 2006" (index .Pages 0).Date }}</a></li> <li><a href="/{{ time.Format "2006/01/" (index .Pages 0).Date }}">{{ time.Format "January 2006" (index .Pages 0).Date }}</a></li>
{{ end }} {{ end }}
</ul> </ul>
</section> </section>

27
layouts/archd/single.html Normal file
View File

@ -0,0 +1,27 @@
{{ define "main" }}
<h1>Arquivos diários: {{ time.Format "02 de January 2006" .Date }}</h1>
{{ $year := .Date.Format "2006-01-02" }}
<ul class='articles detailed'>
{{ range (where site.Pages "Section" "artigos") }}
{{ if (eq (.Date.Format "2006-01-02") $year) }}
<li>
{{ $cover := (index (.Resources.ByType "image") 0) }}
{{ if $cover }}
<img src="{{ $cover.Permalink }}" alt="{{ .Params.coverdescription }}" title="{{ .Params.coverdescription }}" />
{{ end }}
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class='summary'>
{{ .Summary }}
</div>
<p class='readmore'><a href="{{ .Permalink }}">Ler artigo completo →</a></p>
{{ partial "byline.html" . }}
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}

29
layouts/archm/single.html Normal file
View File

@ -0,0 +1,29 @@
{{ define "main" }}
<h1>Arquivos mensais: {{ time.Format "January 2006" .Date }}</h1>
{{ $year := .Date.Format "2006-01" }}
<ul class='articles detailed'>
{{ range (where site.Pages "Section" "artigos") }}
{{ if (eq (.Date.Format "2006-01") $year) }}
<li>
{{ $cover := (index (.Resources.ByType "image") 0) }}
{{ if $cover }}
<img src="{{ $cover.Permalink }}" alt="{{ .Params.coverdescription }}" title="{{ .Params.coverdescription }}" />
{{ end }}
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class='summary'>
{{ .Summary }}
</div>
<p class='readmore'><a href="{{ .Permalink }}">Ler artigo completo →</a></p>
{{ partial "byline.html" . }}
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}

28
layouts/archy/single.html Normal file
View File

@ -0,0 +1,28 @@
{{ define "main" }}
<h1>Arquivos anuais: {{ .Date.Format "2006" }}</h1>
{{ $year := .Date.Format "2006" }}
<ul class='articles detailed'>
{{ range (where site.Pages "Section" "artigos") }}
{{ if (eq (.Date.Format "2006") $year) }}
<li>
{{ $cover := (index (.Resources.ByType "image") 0) }}
{{ if $cover }}
<img src="{{ $cover.Permalink }}" alt="{{ .Params.coverdescription }}" title="{{ .Params.coverdescription }}" />
{{ end }}
<h2><a href="{{ .Permalink }}">{{ .Title }}</a></h2>
<div class='summary'>
{{ .Summary }}
</div>
<p class='readmore'><a href="{{ .Permalink }}">Ler artigo completo →</a></p>
{{ partial "byline.html" . }}
</li>
{{ end }}
{{ end }}
</ul>
{{ end }}

13
mkarchive.sh Executable file
View File

@ -0,0 +1,13 @@
#!/usr/bin/env bash
mkdir -p content/archd
mkdir -p content/archm
mkdir -p content/archy
ack -hm 1 "^date:" content/artigos | sed -e 's/^date: \(....\)-..-.. ..:..:../\1/' | sort -u |
while read archy; do echo -e "---\ndate: $archy-01-01 00:00:00\n---" > content/archy/$archy.md; done
ack -hm 1 "^date:" content/artigos | sed -e 's/^date: \(....-..\)-.. ..:..:../\1/' | sort -u |
while read archm; do echo -e "---\ndate: $archm-01 00:00:00\n---" > content/archm/$archm.md; done
ack -hm 1 "^date:" content/artigos | sed -e 's/^date: \(....-..-..\) ..:..:../\1/' | sort -u |
while read archd; do echo -e "---\ndate: $archd 00:00:00\n---" > content/archd/$archd.md; done

View File

@ -94,6 +94,7 @@ hr {
background-image: url(/widget-divider.png); background-image: url(/widget-divider.png);
} }
.byline { clear: both; padding-top: 1rem; }
.articles:not(.detailed) .byline { display: none; } .articles:not(.detailed) .byline { display: none; }
.articles:not(.detailed) { border-top: none; padding-top: 0.5rem; } .articles:not(.detailed) { border-top: none; padding-top: 0.5rem; }