Afegida paginació i configuarció del tema.

This commit is contained in:
2021-10-30 15:08:55 +02:00
parent 1c27c481cd
commit c2b72e32f0
8 changed files with 102 additions and 6 deletions

View File

@@ -1,6 +1,5 @@
---
title: "{{ replace .Name "-" " " | title }}"
date: {{ .Date }}
draft: true
---

7
archetypes/post.md Normal file
View File

@@ -0,0 +1,7 @@
---
title: "{{ replace .Name "-" " " | title }}"
author: ""
date: {{ .Date }}
type: post
draft: true
---

View File

@@ -8,6 +8,7 @@ params:
themeColor: green # ["orange", "blue", "red", "green", "pink"]
fullWidthTheme: false
centerTheme: true
postTypeName: post
logo:
logoText: L'Ajuntament

View File

@@ -9,12 +9,16 @@ Això és l'Ajuntament oficial a l'ombra! Ben aviat serem a tot el poble, i als
## Un subtítol
Sabem fer moltes coses! Per exemple: _Text torçat_ Uau! Com mola!
![El Marc i el Nil!](/img/el_marc_i_el_nil.gif)
{{< figure
src="/img/el_marc_i_el_nil.gif"
position="center" alt="El Marc i el Nil!"
style="border-radius: 8px;"
caption="Aquests som nosaltres"
captionStyle="border-radius: 8px;" >}}
# Som uns hackers
Una miqueta de codi
```python
{{< code language="python" title="Una mica de codi" >}}
import random
import time
@@ -26,7 +30,7 @@ def un_membre():
print(f"El jefe de l'Ajuntament és...")
time.sleep(1)
print(un_membre())
```
{{< /code >}}
# Un nou punt
Això s'ha afegit automàticament!

View File

@@ -2,6 +2,7 @@
title: "00 - Conceptes bàsics"
author: "Marc Sastre Rienitz"
date: 2021-10-27T21:56:35+02:00
type: post
---
# Què és un programa?

View File

@@ -2,6 +2,7 @@
title: "01 - Conceptes bàsics II"
author: "Marc Sastre Rienitz"
date: 2021-10-29T19:05:57+02:00
type: post
draft: true
---

View File

@@ -0,0 +1,57 @@
{{ define "main" }}
<div class="post">
<h1 class="post-title">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h1>
<div class="post-meta">
{{ if .Params.Date }}
<span class="post-date">
{{ .Date.Format "2006-01-02" }} {{ if $.Site.Params.showLastUpdated }}[{{or $.Site.Params.updatedDatePrefix "Updated"}}: {{ .Lastmod.Format "2006-01-02" }}]{{ end }}
</span>
{{ end }}
{{ with .Params.Author }}
<span class="post-author">:: {{ . }}</span>
{{ end }}
</div>
{{ if .Params.tags }}
<span class="post-tags">
{{ range .Params.tags }}
#<a href="{{ (urlize (printf "tags/%s/" .)) | absLangURL }}">{{ . }}</a>&nbsp;
{{ end }}
</span>
{{ end }}
{{ if .Params.Cover }}
<img src="{{ .Params.Cover | absURL }}" class="post-cover" alt="{{ .Title | plainify | default " " }}" />
{{ end }}
{{ if .Params.Toc }}
<div class="table-of-contents">
<h2>
{{ if .Params.TocTitle }}
{{ .Params.TocTitle }}
{{ else if $.Site.Params.TocTitle }}
{{ $.Site.Params.TocTitle }}
{{ else }}
Table of Contents
{{ end }}
</h2>
{{ .TableOfContents }}
</div>
{{ end }}
<div class="post-content">
{{- with .Content -}}
<div>
{{ . | replaceRE "(<h[1-9] id=\"([^\"]+)\".+)(</h[1-9]+>)" `${1}<a href="#${2}" class="hanchor" ariaLabel="Anchor">&#8983;</a> ${3}` | safeHTML }}
</div>
{{- end -}}
</div>
{{ if eq .Type $.Site.Params.postTypeName }}
{{ partial "posts_pagination.html" . }}
{{ end }}
{{ partial "comments.html" . }}
</div>
{{ end }}

View File

@@ -0,0 +1,26 @@
{{ if or .NextInSection .PrevInSection }}
<div class="pagination">
<div class="pagination__title">
<span class="pagination__title-h">{{ $.Site.Params.ReadOtherPosts }}</span>
<hr />
</div>
<div class="pagination__buttons">
{{ if .PrevInSection }}
<span class="button previous">
<a href="{{ .PrevInSection.Permalink }}">
<span class="button__icon"></span>
<span class="button__text">{{ .PrevInSection.Title }}</span>
</a>
</span>
{{ end }}
{{ if .NextInSection }}
<span class="button next">
<a href="{{ .NextInSection.Permalink }}">
<span class="button__text">{{ .NextInSection.Title }}</span>
<span class="button__icon"></span>
</a>
</span>
{{ end }}
</div>
</div>
{{ end }}