summaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authormms <michal@sapka.me>2024-06-24 22:33:54 +0200
committermms <michal@sapka.me>2024-06-24 22:33:54 +0200
commit0558766defa08e3d160dde57875c3d4135cc3bed (patch)
tree9e2c0be73811698f95167f7f4d26ffec9b3d19fa /layouts
parentdd5be9412da9e0bcf7f3650d92bb592d77ce8a13 (diff)
feat: cross-post on blog
Diffstat (limited to 'layouts')
-rw-r--r--layouts/blog/baseof.html15
-rw-r--r--layouts/blog/list.html14
-rw-r--r--layouts/partials/blog/cross-site-post.html37
-rw-r--r--layouts/partials/blog/full-post.html13
4 files changed, 74 insertions, 5 deletions
diff --git a/layouts/blog/baseof.html b/layouts/blog/baseof.html
index 1714b89..9b0700a 100644
--- a/layouts/blog/baseof.html
+++ b/layouts/blog/baseof.html
@@ -163,6 +163,21 @@
text-align: justify;
display: flow-root;
}
+
+ article.link {
+ padding: 20px;
+ display: flex;
+ justify-content: center;
+ }
+ article.link .img {
+ padding-right: 20px;
+ flex-grow: 0;
+ height: 32px;
+ width: 32px;
+ }
+ article.link .text {
+ flex-grow: 1;
+ }
article figure {
text-align: center;
diff --git a/layouts/blog/list.html b/layouts/blog/list.html
index bf20f9d..58cb880 100644
--- a/layouts/blog/list.html
+++ b/layouts/blog/list.html
@@ -5,16 +5,20 @@
{{ .Page.Content }}
</article>
{{ else }}
-{{ $paginator := .Paginator 10 }}
+{{ $paginator := .Paginate .Site.RegularPages.ByDate.Reverse 10 }}
-{{ range (.Paginate (where .Site.Pages.ByDate "Section" .Section )).Pages }}
- {{ partial "partials/article_list_full_item.html" . }}
+{{ range $paginator.Pages }}
+{{ if eq .Section "blog" }}
+{{ partial "partials/blog/full-post.html" . }}
+{{ else }}
+{{ partial "partials/blog/cross-site-post.html" . }}
+{{ end }}
{{ end }}
<nav class="blog-pages-list">
Pages:
{{ if $paginator.HasPrev }}
- [ <a href="{{ $paginator.Prev.URL}}">previous</a> ]
+ <span>[ <a href="{{ $paginator.Prev.URL}}">previous</a> ]</span>
{{ end }}
{{ range seq $paginator.TotalPages }}
@@ -26,7 +30,7 @@
{{ end }}
{{ if $paginator.HasNext }}
- [ <a href="{{ $paginator.Next.URL}}">Next</a> ]
+ <span>[ <a href="{{ $paginator.Next.URL}}">Next</a> ]</span>
{{ end }}
</nav>
diff --git a/layouts/partials/blog/cross-site-post.html b/layouts/partials/blog/cross-site-post.html
new file mode 100644
index 0000000..3a13af8
--- /dev/null
+++ b/layouts/partials/blog/cross-site-post.html
@@ -0,0 +1,37 @@
+{{ $section := "some other site" }}
+
+{{ if eq .Section "cool-emacs" }}
+ {{ $section = "Cool Emacs" }}
+{{ else if eq .Section "brain-rot" }}
+ {{ $section = "Brain Rots" }}
+{{ else if eq .Section "unix-history" }}
+ {{ $section = "Unix History" }}
+{{ else if eq .Section "star-trek" }}
+ {{ $section = "Star Trek" }}
+{{ end }}
+
+<article class="link">
+ {{- $img := resources.Get "blog/assets/arrow.gif" }}
+ {{- $img1x := $img.Resize "32x webp" }}
+ {{- $img2x := $img.Resize "64x webp" }}
+ <div class="img">
+ <a href="{{ .Permalink }}"><img
+ alt="Arrow"
+ src="{{ $img1x.Permalink }}"
+ srcset="
+ {{ $img1x.Permalink }} 1x,
+ {{ $img2x.Permalink }} 2x
+ "
+ width="{{ $img1x.Width }}"
+ height="{{ $img1x.Height }}"
+ ></a>
+ </div>
+ <div class="text">
+ <time datetime="{{.PublishDate.Format "2006-01-02" }}">
+ {{ .PublishDate.Format "January 2, 2006" }}
+ </time><br>
+ I published
+ <a href="{{ .Permalink }}">"{{ .Title }}"</a>
+ on {{ $section }}
+ </div>
+</article>
diff --git a/layouts/partials/blog/full-post.html b/layouts/partials/blog/full-post.html
new file mode 100644
index 0000000..31ab76f
--- /dev/null
+++ b/layouts/partials/blog/full-post.html
@@ -0,0 +1,13 @@
+<article class="blog-post-item">
+ <h2> <a href="{{ .Page.Permalink }}"> {{ .Title }}</a></h2>
+
+ <time datetime="{{.PublishDate.Format "2006-01-02" }}">
+ {{ .PublishDate.Format "January 2, 2006" }}
+ </time>
+
+ <nav>
+ <a href="{{ .Page.Permalink }}">[ Permalink ]</a>
+ </nav>
+
+ {{ .Page.Content }}
+</article>