Compare commits

...

5 Commits

Author SHA1 Message Date
17947be625 Improve taxonomy handling
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-09-12 13:33:41 +01:00
d86cc63aa4 Fix unhighlighted code styles
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-09-12 12:05:37 +01:00
49d90045db Add shell prompt support
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-09-12 11:16:18 +01:00
4e2c24ad59 Fix layout bugs
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-09-11 17:43:07 +00:00
903227b07c Add image processing
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-09-11 17:42:53 +00:00
21 changed files with 624 additions and 591 deletions

View File

@@ -1,5 +1,4 @@
/* PreWrapper */ pre {
.chroma {
color: var(--text); color: var(--text);
background-color: var(--background-50); background-color: var(--background-50);
padding: 1rem; padding: 1rem;
@@ -7,411 +6,418 @@
overflow-x: auto; overflow-x: auto;
} }
/* Error */ /* PreWrapper */
.chroma .err { .chroma {
color: var(--accent-500); .line.prompt::before {
} content: "$ ";
}
/* LineLink */ /* Error */
.chroma .lnlinks { .err {
color: var(--accent-500);
}
/* LineLink */
.lnlinks {
outline: none; outline: none;
text-decoration: none; text-decoration: none;
color: inherit; color: inherit;
} }
/* LineTableTD */ /* LineTableTD */
.chroma .lntd { .lntd {
vertical-align: top; vertical-align: top;
padding: 0; padding: 0;
margin: 0; margin: 0;
border: 0; border: 0;
} }
/* LineTable */ /* LineTable */
.chroma .lntable { .lntable {
border-spacing: 0; border-spacing: 0;
padding: 0; padding: 0;
margin: 0; margin: 0;
border: 0; border: 0;
} }
/* LineHighlight */ /* LineHighlight */
.chroma .hl { .hl {
background-color: var(--background-200); background-color: var(--background-200);
} }
/* LineNumbersTable */ /* LineNumbersTable */
.chroma .lnt { .lnt {
white-space: pre; white-space: pre;
-webkit-user-select: none; -webkit-user-select: none;
user-select: none; user-select: none;
margin-right: 0.4em; margin-right: 0.4em;
padding: 0 0.4em 0 0.4em; padding: 0 0.4em 0 0.4em;
} }
/* LineNumbers */ /* LineNumbers */
.chroma .ln { .ln {
white-space: pre; white-space: pre;
-webkit-user-select: none; -webkit-user-select: none;
user-select: none; user-select: none;
margin-right: 0.4em; margin-right: 0.4em;
padding: 0 0.4em 0 0.4em; padding: 0 0.4em 0 0.4em;
color: color-mix(in srgb, var(--text) 50%, var(--background-50)); color: color-mix(in srgb, var(--text) 50%, var(--background-50));
} }
/* Line */ /* Line */
.chroma .line { .line {
display: flex; display: flex;
} }
/* Keyword */ /* Keyword */
.chroma .k { .k {
color: var(--secondary-600); color: var(--secondary-600);
} }
/* KeywordConstant */ /* KeywordConstant */
.chroma .kc { .kc {
color: var(--primary-500); color: var(--primary-500);
} }
/* KeywordDeclaration */ /* KeywordDeclaration */
.chroma .kd { .kd {
color: var(--secondary-600); color: var(--secondary-600);
} }
/* KeywordNamespace */ /* KeywordNamespace */
.chroma .kn { .kn {
color: var(--secondary-600); color: var(--secondary-600);
} }
/* KeywordPseudo */ /* KeywordPseudo */
.chroma .kp { .kp {
color: var(--primary-500); color: var(--primary-500);
} }
/* KeywordReserved */ /* KeywordReserved */
.chroma .kr { .kr {
color: var(--secondary-600); color: var(--secondary-600);
} }
/* KeywordType */ /* KeywordType */
.chroma .kt { .kt {
color: var(--secondary-600); color: var(--secondary-600);
} }
/* Name */ /* Name */
.chroma .nc { .nc {
color: var(--accent-600); color: var(--accent-600);
font-weight: bold; font-weight: bold;
} }
/* NameConstant */ /* NameConstant */
.chroma .no { .no {
color: var(--primary-500); color: var(--primary-500);
font-weight: bold; font-weight: bold;
} }
/* NameDecorator */ /* NameDecorator */
.chroma .nd { .nd {
color: var(--secondary-700); color: var(--secondary-700);
font-weight: bold; font-weight: bold;
} }
/* NameEntity */ /* NameEntity */
.chroma .ni { .ni {
color: var(--accent-600); color: var(--accent-600);
} }
/* NameException */ /* NameException */
.chroma .ne { .ne {
color: var(--accent-600); color: var(--accent-600);
font-weight: bold; font-weight: bold;
} }
/* NameLabel */ /* NameLabel */
.chroma .nl { .nl {
color: var(--primary-500); color: var(--primary-500);
font-weight: bold; font-weight: bold;
} }
/* NameNamespace */ /* NameNamespace */
.chroma .nn { .nn {
color: var(--secondary-600); color: var(--secondary-600);
} }
/* NameProperty */ /* NameProperty */
.chroma .py { .py {
color: var(--primary-500); color: var(--primary-500);
} }
/* NameTag */ /* NameTag */
.chroma .nt { .nt {
color: var(--primary-600); color: var(--primary-600);
} }
/* NameVariable */ /* NameVariable */
.chroma .nv { .nv {
color: var(--primary-500); color: var(--primary-500);
} }
/* NameVariableClass */ /* NameVariableClass */
.chroma .vc { .vc {
color: var(--primary-500); color: var(--primary-500);
} }
/* NameVariableGlobal */ /* NameVariableGlobal */
.chroma .vg { .vg {
color: var(--primary-500); color: var(--primary-500);
} }
/* NameVariableInstance */ /* NameVariableInstance */
.chroma .vi { .vi {
color: var(--primary-500); color: var(--primary-500);
} }
/* NameVariableMagic */ /* NameVariableMagic */
.chroma .vm { .vm {
color: var(--primary-500); color: var(--primary-500);
} }
/* NameFunction */ /* NameFunction */
.chroma .nf { .nf {
color: var(--secondary-700); color: var(--secondary-700);
font-weight: bold; font-weight: bold;
} }
/* NameFunctionMagic */ /* NameFunctionMagic */
.chroma .fm { .fm {
color: var(--secondary-700); color: var(--secondary-700);
font-weight: bold; font-weight: bold;
} }
/* Literal */ /* Literal */
.chroma .l { .l {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralDate */ /* LiteralDate */
.chroma .ld { .ld {
color: var(--primary-500); color: var(--primary-500);
} }
/* LiteralString */ /* LiteralString */
.chroma .s { .s {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralStringAffix */ /* LiteralStringAffix */
.chroma .sa { .sa {
color: var(--primary-500); color: var(--primary-500);
} }
/* LiteralStringBacktick */ /* LiteralStringBacktick */
.chroma .sb { .sb {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralStringChar */ /* LiteralStringChar */
.chroma .sc { .sc {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralStringDelimiter */ /* LiteralStringDelimiter */
.chroma .dl { .dl {
color: var(--primary-500); color: var(--primary-500);
} }
/* LiteralStringDoc */ /* LiteralStringDoc */
.chroma .sd { .sd {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralStringDouble */ /* LiteralStringDouble */
.chroma .s2 { .s2 {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralStringEscape */ /* LiteralStringEscape */
.chroma .se { .se {
color: var(--primary-500); color: var(--primary-500);
} }
/* LiteralStringHeredoc */ /* LiteralStringHeredoc */
.chroma .sh { .sh {
color: var(--primary-500); color: var(--primary-500);
} }
/* LiteralStringInterpol */ /* LiteralStringInterpol */
.chroma .si { .si {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralStringOther */ /* LiteralStringOther */
.chroma .sx { .sx {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralStringRegex */ /* LiteralStringRegex */
.chroma .sr { .sr {
color: var(--primary-500); color: var(--primary-500);
} }
/* LiteralStringSingle */ /* LiteralStringSingle */
.chroma .s1 { .s1 {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralStringSymbol */ /* LiteralStringSymbol */
.chroma .ss { .ss {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralNumber */ /* LiteralNumber */
.chroma .m { .m {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralNumberBin */ /* LiteralNumberBin */
.chroma .mb { .mb {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralNumberFloat */ /* LiteralNumberFloat */
.chroma .mf { .mf {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralNumberHex */ /* LiteralNumberHex */
.chroma .mh { .mh {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralNumberInteger */ /* LiteralNumberInteger */
.chroma .mi { .mi {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralNumberIntegerLong */ /* LiteralNumberIntegerLong */
.chroma .il { .il {
color: var(--primary-600); color: var(--primary-600);
} }
/* LiteralNumberOct */ /* LiteralNumberOct */
.chroma .mo { .mo {
color: var(--primary-600); color: var(--primary-600);
} }
/* Operator */ /* Operator */
.chroma .o { .o {
color: var(--secondary-600); color: var(--secondary-600);
font-weight: bold; font-weight: bold;
} }
/* OperatorWord */ /* OperatorWord */
.chroma .ow { .ow {
color: var(--secondary-600); color: var(--secondary-600);
font-weight: bold; font-weight: bold;
} }
/* Comment */ /* Comment */
.chroma .c { .c {
color: color-mix(in srgb, var(--text) 50%, var(--background-50)); color: color-mix(in srgb, var(--text) 50%, var(--background-50));
font-style: italic; font-style: italic;
} }
/* CommentHashbang */ /* CommentHashbang */
.chroma .ch { .ch {
color: color-mix(in srgb, var(--text) 50%, var(--background-50)); color: color-mix(in srgb, var(--text) 50%, var(--background-50));
font-style: italic; font-style: italic;
} }
/* CommentMultiline */ /* CommentMultiline */
.chroma .cm { .cm {
color: color-mix(in srgb, var(--text) 50%, var(--background-50)); color: color-mix(in srgb, var(--text) 50%, var(--background-50));
font-style: italic; font-style: italic;
} }
/* CommentSingle */ /* CommentSingle */
.chroma .c1 { .c1 {
color: color-mix(in srgb, var(--text) 50%, var(--background-50)); color: color-mix(in srgb, var(--text) 50%, var(--background-50));
font-style: italic; font-style: italic;
} }
/* CommentSpecial */ /* CommentSpecial */
.chroma .cs { .cs {
color: color-mix(in srgb, var(--text) 50%, var(--background-50)); color: color-mix(in srgb, var(--text) 50%, var(--background-50));
font-weight: bold; font-weight: bold;
font-style: italic; font-style: italic;
} }
/* CommentPreproc */ /* CommentPreproc */
.chroma .cp { .cp {
color: color-mix(in srgb, var(--text) 50%, var(--background-50)); color: color-mix(in srgb, var(--text) 50%, var(--background-50));
font-weight: bold; font-weight: bold;
font-style: italic; font-style: italic;
} }
/* CommentPreprocFile */ /* CommentPreprocFile */
.chroma .cpf { .cpf {
color: color-mix(in srgb, var(--text) 50%, var(--background-50)); color: color-mix(in srgb, var(--text) 50%, var(--background-50));
font-weight: bold; font-weight: bold;
font-style: italic; font-style: italic;
} }
/* GenericDeleted */ /* GenericDeleted */
.chroma .gd { .gd {
color: var(--accent-900); color: var(--accent-900);
background-color: var(--accent-300); background-color: var(--accent-300);
} }
/* GenericEmph */ /* GenericEmph */
.chroma .ge { .ge {
font-style: italic; font-style: italic;
} }
/* GenericError */ /* GenericError */
.chroma .gr { .gr {
color: var(--accent-500); color: var(--accent-500);
} }
/* GenericHeading */ /* GenericHeading */
.chroma .gh { .gh {
color: var(--primary-500); color: var(--primary-500);
font-weight: bold; font-weight: bold;
} }
/* GenericInserted */ /* GenericInserted */
.chroma .gi { .gi {
color: var(--primary-800); color: var(--primary-800);
background-color: var(--primary-200); background-color: var(--primary-200);
} }
/* GenericOutput */ /* GenericOutput */
.chroma .go { .go {
color: color-mix(in srgb, var(--text) 70%, var(--background-50)); color: color-mix(in srgb, var(--text) 70%, var(--background-50));
} }
/* GenericPrompt */ /* GenericPrompt */
.chroma .gp { .gp {
color: color-mix(in srgb, var(--text) 70%, var(--background-50)); color: color-mix(in srgb, var(--text) 70%, var(--background-50));
} }
/* GenericStrong */ /* GenericStrong */
.chroma .gs { .gs {
font-weight: bold; font-weight: bold;
} }
/* GenericSubheading */ /* GenericSubheading */
.chroma .gu { .gu {
color: var(--primary-500); color: var(--primary-500);
} }
/* GenericTraceback */ /* GenericTraceback */
.chroma .gt { .gt {
color: var(--secondary-600); color: var(--secondary-600);
} }
/* GenericUnderline */ /* GenericUnderline */
.chroma .gl { .gl {
text-decoration: underline; text-decoration: underline;
}
} }

View File

@@ -16,16 +16,6 @@ a:hover {
color: var(--text-800); color: var(--text-800);
} }
sup,
sub {
color: var(--text-600);
}
sup:hover,
sub:hover {
color: var(--text-800);
}
h1, h1,
h2, h2,
h3, h3,
@@ -64,3 +54,11 @@ body {
flex: 1; flex: 1;
} }
} }
p {
margin: 1.5rem 0 1.5rem 0;
}
li {
margin: 0.5rem 0 0.5rem 0;
}

55
assets/sass/details.scss Normal file
View File

@@ -0,0 +1,55 @@
main.with-details {
max-width: $width-wide;
margin: 0 auto;
padding: 2rem;
> .content {
width: 100%;
padding: 0;
}
$width-sidebar: ($width-wide - $width-content) / 2 - 2rem;
display: grid;
grid-template-columns: $width-sidebar $width-content $width-sidebar;
column-gap: 2rem;
.title {
font-size: 1.75rem;
margin: 0;
}
.length {
color: color-mix(in srgb, var(--text) 50%, var(--background));
margin: 0.5rem 0 0.5rem 0;
font-size: 0.8rem;
}
}
@media (max-width: $width-wide) {
main.with-details {
display: block;
padding: 0;
> .details {
max-width: $width-content;
margin: 0 auto;
padding: 2rem;
}
> .content {
padding: 2rem;
}
}
}
@media (max-width: $width-mobile) {
main.with-details {
> .details {
padding: 1rem;
}
> .content {
padding: 0 1rem 1rem 1rem;
}
}
}

View File

@@ -36,6 +36,7 @@
list-style: none; list-style: none;
li { li {
margin: 0;
font-size: 0.85rem; font-size: 0.85rem;
} }
} }

View File

@@ -1,28 +1,12 @@
.hero { .hero {
max-width: $width-content; max-width: $width-content;
margin: 0 auto; margin: 0 auto;
padding: 2rem; padding: 2rem 2rem 0 2rem;
.title { .title {
margin: 0; margin: 0;
font-size: 2.5rem; font-size: 2.5rem;
} }
.meta {
font-size: 0.8rem;
.date {
color: var(--text-600);
}
.duration {
color: color-mix(in srgb, var(--text) 50%, var(--background));
}
}
.captioned-image {
padding-top: 1.5rem;
}
} }
.hero + .content { .hero + .content {

View File

@@ -1,64 +1,17 @@
main.with-meta {
max-width: $width-wide;
margin: 0 auto;
padding: 2rem;
> .content {
padding: 0;
}
$width-sidebar: ($width-wide - $width-content) / 2 - 2rem;
display: grid;
grid-template-columns: $width-sidebar $width-content $width-sidebar;
column-gap: 2rem;
h1 {
font-size: 1.75rem;
}
.length {
color: color-mix(in srgb, var(--text) 50%, var(--background));
margin: 0.25rem 0;
font-size: 0.8rem;
}
}
@media (max-width: $width-wide) {
main.with-meta {
display: block;
padding: 0;
> .meta {
max-width: $width-content;
margin: 0 auto;
padding: 2rem;
}
> .content {
padding: 2rem;
}
}
}
@media (max-width: $width-mobile) {
main.with-meta {
> .meta {
padding: 1rem;
}
> .content {
padding: 0 1rem 1rem 1rem;
}
}
}
.list { .list {
.post { .post {
display: block; display: block;
>a {
color: inherit; color: inherit;
}
>a:hover {
color: var(--text-800);
}
&:not(:first-child) { &:not(:first-child) {
margin-top: 4rem; margin: 4rem 0 4rem 0;
} }
.title { .title {
@@ -67,38 +20,20 @@ main.with-meta {
} }
.summary { .summary {
margin-top: 0.5rem; margin: 0.5rem 0 0.5rem 0;
}
.meta {
margin-top: 1rem;
font-size: 0.8rem;
.date {
color: var(--text-600);
}
.duration {
color: color-mix(in srgb, var(--text) 50%, var(--background));
}
} }
.heading-anchor { .heading-anchor {
display: none; display: none;
} }
} }
.post:hover .title,
.post:hover .summary {
color: var(--text-800);
}
} }
@media (max-width: $width-mobile) { @media (max-width: $width-mobile) {
.list { .list {
.post { .post {
&:not(:first-child) { &:not(:first-child) {
margin-top: 2rem; margin: 2rem 0 2rem 0;
} }
.title { .title {

View File

@@ -11,7 +11,9 @@ $width-wide: 75rem;
@import "blockquote"; @import "blockquote";
@import "code"; @import "code";
@import "table"; @import "table";
@import "meta";
@import "details";
@import "list"; @import "list";
@import "gallery"; @import "gallery";

20
assets/sass/meta.scss Normal file
View File

@@ -0,0 +1,20 @@
.meta {
margin: 1rem 0 1rem 0;
font-size: 0.8rem;
.tag {
color: var(--secondary-600);
}
.tag:hover {
color: var(--secondary-800);
}
.date {
color: var(--text-600);
}
.duration {
color: color-mix(in srgb, var(--text) 50%, var(--background));
}
}

View File

@@ -0,0 +1,4 @@
{{ $result := transform.HighlightCodeBlock . }}
{{ $pattern := `(?s)<span class="line"([^>]*)>(\s*<span[^>]*>)?\$ (.*?)(</span>\s*)</span>` }}
{{ $processed := replaceRE $pattern `<span class="line prompt"$1>$2$3$4</span>` $result.Wrapped }}
{{ $processed | safeHTML }}

View File

@@ -1,7 +1,7 @@
{{ partial "components/image/index.html" (dict {{ partial "components/image/index.html" (dict "page" .Page "image" (dict
"src" .Destination "src" .Destination
"caption" .Text "caption" .Text
"alt" .Title "alt" .Title
) ))
}} }}
{{- /* chomp trailing newline */ -}} {{- /* chomp trailing newline */ -}}

View File

@@ -1,8 +1,8 @@
{{ define "main" }} {{ define "main" }}
{{ $withMeta := default true .Params.withMeta }} {{ $details := default true .Params.details }}
<main class="{{- if $withMeta -}}with-meta{{- end -}}"> <main class="{{- if $details -}}with-details{{- end -}}">
{{ if $withMeta }} {{ if $details }}
{{ partial "components/list/meta.html" . }} {{ partial "components/list/details.html" . }}
{{ end }} {{ end }}
<div class="content"> <div class="content">
{{ partial "posts/list.html" . }} {{ partial "posts/list.html" . }}

View File

@@ -0,0 +1 @@
<sub>{{ .Get 0 | markdownify }}</sub> {{- /* chomp trailing newline */ -}}

View File

@@ -0,0 +1 @@
<sup>{{ .Get 0 | markdownify }}</sup> {{- /* chomp trailing newline */ -}}

View File

@@ -1,10 +1,16 @@
{{ define "main" }} {{ define "main" }}
{{ $withMeta := default true .Params.withMeta }} {{ $details := default true .Params.details }}
<main class="{{- if $withMeta -}}with-meta{{- end -}}"> <main class="{{- if $details -}}with-details{{- end -}}">
{{ if $withMeta }} {{ if $details }}
{{ partial "components/list/meta.html" . }} {{ partial "components/list/details.html" . }}
{{ end }} {{ end }}
<div class="{{- if $withMeta -}}content{{- else -}}content wide{{- end -}}"> <div
class="{{- if $details -}}
content
{{- else -}}
content wide
{{- end -}}"
>
{{ partial "gallery/list.html" . }} {{ partial "gallery/list.html" . }}
</div> </div>
</main> </main>

View File

@@ -1,9 +1,5 @@
<section class="hero"> <section class="hero">
<h1 class="title">{{ .Title }}</h1> <h1 class="title">{{ .Title }}</h1>
<div class="meta"> {{ partial "components/meta/index.html" . }}
<span class="date">{{ .Date | time.Format ":date_medium" }}</span> {{ partial "components/image/index.html" (dict "page" .Page "image" .Params.hero) }}
&middot;
<span class="duration">{{ printf "%d MIN READ" .ReadingTime }}</span>
</div>
{{ partial "components/image/index.html" .Params.hero }}
</section> </section>

View File

@@ -1,5 +1,40 @@
{{ $imageData := partial "components/image/reflect.html" . }} {{- $page := .page -}}
{{- with $imageData.image -}} {{- $image := .image -}}
{{- $src := $image -}}
{{- $caption := "" -}}
{{- $title := "" -}}
{{- $alt := "" -}}
{{- if reflect.IsMap $image -}}
{{- $src = $image.src | default "" -}}
{{- $caption = $image.caption | default "" -}}
{{- $title = $image.title | default $caption | default "" | plainify -}}
{{- $alt = $image.alt | default $title | default "" | plainify -}}
{{- end -}}
{{- if $src -}}
{{- $isRemote := strings.HasPrefix $src "http" -}}
{{- if $isRemote -}}
{{- $remote := resources.GetRemote $src -}}
{{- $image = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}}
{{- else -}}
{{- $image = ($page.Resources.Get $src) | default (resources.Get $src) -}}
{{- end -}}
{{- end -}}
{{- with $image -}}
{{ $full := . | images.Filter (images.Process "webp q90") }}
{{ $thumb := . }}
{{- if gt .Width 2000 -}}
{{- $thumb = . | images.Filter (images.Process "resize 2000x webp q75") -}}
{{- else -}}
{{- $thumb = . | images.Filter (images.Process "webp q75") -}}
{{- end -}}
<figure class="captioned-image lightbox"> <figure class="captioned-image lightbox">
<a <a
href="{{- .RelPermalink -}}" href="{{- .RelPermalink -}}"
@@ -9,16 +44,16 @@
class="pswp-image" class="pswp-image"
> >
<img <img
src="{{- .RelPermalink -}}" src="{{- $thumb.RelPermalink -}}"
width="{{- .Width -}}" width="{{- .Width -}}"
height="{{- .Height -}}" height="{{- .Height -}}"
loading="lazy" loading="lazy"
{{ with $imageData.title }}title="{{- . -}}"{{ end }} {{ with $title }}title="{{- . -}}"{{ end }}
{{ with $imageData.alt }}alt="{{- . -}}"{{ end }} {{ with $alt }}alt="{{- . -}}"{{ end }}
/> />
</a> </a>
{{ with $imageData.caption }} {{ with $caption }}
<figcaption>{{ . }}</figcaption> <figcaption>{{ . | safeHTML }}</figcaption>
{{ end }} {{ end }}
</figure> </figure>
{{- end -}} {{- end -}}

View File

@@ -1,31 +0,0 @@
{{- $input := . -}}
{{- $src := $input -}}
{{- $caption := "" -}}
{{- $title := "" -}}
{{- $alt := "" -}}
{{- if reflect.IsMap $input -}}
{{- $src = $input.src | default "" -}}
{{- $caption = $input.caption | default "" -}}
{{- $title = $input.title | default $caption | default "" -}}
{{- $alt = $input.alt | default $title | default "" -}}
{{- end -}}
{{ $result := dict "image" nil "caption" $caption "title" $title "alt" $alt }}
{{- if $src -}}
{{- $isRemote := strings.HasPrefix $src "http" -}}
{{- $image := "" -}}
{{- if $isRemote -}}
{{- $remote := resources.GetRemote $src -}}
{{- $image = resources.Copy (printf "static/3rd-party/%s" $remote.Name) $remote -}}
{{- else -}}
{{- $image = resources.Get $src -}}
{{- end -}}
{{- $result = (dict "image" $image "caption" $caption "title" $title "alt" $alt) -}}
{{- end -}}
{{- return $result -}}

View File

@@ -1,5 +1,5 @@
<section class="meta"> <section class="details">
<h1>{{ .Page.Title }}</h1> <h1 class="title">{{ .Page.Title }}</h1>
<p class="length">A {{ .Kind }} with {{ len .Pages }} items</p> <p class="length">A {{ .Kind }} with {{ len .Pages }} items</p>
{{ .Content }} {{ .Content }}
</section> </section>

View File

@@ -0,0 +1,18 @@
<div class="meta">
<span class="date">{{ .Date | time.Format ":date_medium" }}</span>
&middot;
{{ if eq .Kind "page" }}
{{ range .Params.tags }}
<a href="/tags/{{ . | urlize }}" class="tag">{{ . }}</a>
&middot;
{{ end }}
<span class="duration">
{{ printf "%d min. read" .ReadingTime }}
</span>
{{ else }}
{{ $count := len .Pages }}
<span class="duration">
{{ printf "%d %s" $count (cond (eq $count 1) "item" "items") }}
</span>
{{ end }}
</div>

View File

@@ -1,8 +1,9 @@
{{ $pages := .CurrentSection.Pages.ByDate }} {{ $pages := .CurrentSection.Pages.ByDate.Reverse }}
<div class="postnav"> <div class="postnav">
{{ with $pages.Prev . }} {{ with $pages.Prev . }}
{{ if eq .Kind "page" }}
<a href="{{ .RelPermalink }}"> <a href="{{ .RelPermalink }}">
<div class="previous"> <div class="previous">
<p class="caption">Previous Post</p> <p class="caption">Previous Post</p>
@@ -10,8 +11,10 @@
</div> </div>
</a> </a>
{{ end }} {{ end }}
{{ end }}
{{ with $pages.Next . }} {{ with $pages.Next . }}
{{ if eq .Kind "page" }}
<a href="{{ .RelPermalink }}"> <a href="{{ .RelPermalink }}">
<div class="next"> <div class="next">
<p class="caption">Next Post</p> <p class="caption">Next Post</p>
@@ -19,4 +22,5 @@
</div> </div>
</a> </a>
{{ end }} {{ end }}
{{ end }}
</div> </div>

View File

@@ -1,15 +1,13 @@
<div class="list"> <div class="list">
{{ range sort .Pages "Date" "desc" }} {{ range sort .Pages "Date" "desc" }}
{{ if not .Params.private }} {{ if not .Params.private }}
<a href="{{- .RelPermalink -}}" class="post"> <div class="post">
<a href="{{- .RelPermalink -}}">
<h1 class="title">{{ .Title }}</h1> <h1 class="title">{{ .Title }}</h1>
<div class="summary">{{ .Summary | plainify }}</div> <div class="summary">{{ .Summary | plainify }}</div>
<div class="meta">
<span class="date">{{ .Date | time.Format ":date_medium" }}</span>
&middot;
<span class="duration">{{ printf "%d MIN READ" .ReadingTime }}</span>
</div>
</a> </a>
{{ partial "components/meta/index.html" . }}
</div>
{{ end }} {{ end }}
{{ end }} {{ end }}
</div> </div>