Blog: enhance layout

This commit is contained in:
Théophile Bastian 2024-04-10 15:43:52 +02:00
parent de415ad907
commit e59b755090
6 changed files with 157 additions and 61 deletions

View file

@ -31,7 +31,7 @@
{{ partial "menu" . }} {{ partial "menu" . }}
</div> </div>
<div id="content"> <div id="content" class="{{ block "contentclass" . }}{{ end }}">
{{ block "pagename" . }} {{ block "pagename" . }}
{{ end }} {{ end }}

View file

@ -10,7 +10,6 @@
<div id="entries"> <div id="entries">
{{ range .Pages }} {{ range .Pages }}
{{ partial "blog/entry_list.html" . }} {{ partial "blog/entry_list.html" . }}
<hr />
{{ end }} {{ end }}
</div> </div>
{{ end }} {{ end }}

20
layouts/blog/single.html Normal file
View file

@ -0,0 +1,20 @@
{{ define "profilepic" }}<div class="nopic"></div>{{ end }}
{{ define "contentclass" }}blog{{ end }}
{{ define "pagename" }}
<div id="post_head">
<div id="post_date">{{ .Date | time.Format ":date_medium" }}</div>
{{ with .GetTerms "blog/tags" }}
<ul id="post_tags">
{{ range . -}}
<li class="tag"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end }}
</ul>
{{ end }}
<h1>{{ .Title }}</h1>
</div>
{{ end }}
{{ define "main" }}
{{ .Content }}
{{ end }}

View file

@ -1,13 +1,13 @@
<div class="blog_entry"> <div class="blog_entry">
<div class="blog_entry_descr"> <div class="blog_entry_meta">
<a href="{{ .Permalink }}" class="blog_entry_title">{{ .Title }}</a>
<span class="blog_entry_date">{{ .Date | time.Format ":date_medium" }}</span>
</div>
{{ with .GetTerms "blog/tags" }} {{ with .GetTerms "blog/tags" }}
<ul class="blog_entry_tags"> <ul class="blog_entry_tags">
{{ range . -}} {{ range . -}}
<li class="tag"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li> <li class="tag"><a href="{{ .RelPermalink }}">{{ .LinkTitle }}</a></li>
{{- end }} {{- end }}
</li> </ul>
{{ end }} {{ end }}
<span class="blog_entry_date">{{ .Date | time.Format ":date_medium" }}</span>
</div>
<a href="{{ .Permalink }}" class="blog_entry_title">{{ .Title }}</a>
</div> </div>

View file

@ -5,48 +5,94 @@
#entries { #entries {
.blog_entry { .blog_entry {
padding: 15px 0; padding: 15px 0;
.blog_entry_descr {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 10px;
.blog_entry_title { .blog_entry_title {
display: block; display: block;
font-size: 1.1em; font-size: 1.1em;
text-align: left; text-align: left;
} }
.blog_entry_date { .blog_entry_meta {
color: $fg_color_light; display: flex;
justify-content: flex-end;
align-items: center;
column-gap: 10px;
font-style: italic; font-style: italic;
font-size: 0.9em;
color: $fg_color_light;
}
.blog_entry_date {
display: block; display: block;
align-self: flex-start; align-self: flex-start;
} }
}
.blog_entry_tags::before {
content: "Tags:"
}
.blog_entry_tags { .blog_entry_tags {
list-style: none; list-style: none;
padding-left: 0; padding-left: 0;
margin: 5px 0; margin: 0;
font-size: 0.9em;
li { li {
display: inline; display: inline;
}
li ~ li::before {
content: ", ";
}
&::before {
content: "Tags:"
}
}
}
}
#post_head {
margin: 20px 0;
h1 {
margin: 5px 0;
}
#post_date {
text-align: right;
font-style: italic;
}
#post_tags {
display: flex;
justify-content: flex-end;
list-style: none;
padding-left: 0;
margin: 5px 0;
&::before {
content: "Tags: ";
font-style: italic;
padding-right: 1em;
}
li {
font-style: italic; font-style: italic;
} }
li ~ li::before { li ~ li::before {
content: ", "; content: ", ";
} }
} }
}
.blog {
.highlight>pre {
padding: 10px;
border-radius: 10px;
} }
hr { img {
width: 80%; display: block;
border-color: $fg_color_light; margin: 10px auto;
max-width: 80%;
max-height: 60vh;
border-radius: 10px;
} }
hr:last-child { blockquote {
display: none; font-style: italic;
border-left: 3px solid #8b8bbd;
padding-left: 15px;
margin-left: 25px;
} }
} }

View file

@ -2,39 +2,70 @@
@import url("fonts.css"); @import url("fonts.css");
#entries .blog_entry { #entries .blog_entry {
padding: 15px 0; } padding: 15px 0; }
#entries .blog_entry .blog_entry_descr { #entries .blog_entry .blog_entry_title {
display: flex;
justify-content: space-between;
align-items: flex-start;
gap: 10px; }
#entries .blog_entry .blog_entry_descr .blog_entry_title {
display: block; display: block;
font-size: 1.1em; font-size: 1.1em;
text-align: left; } text-align: left; }
#entries .blog_entry .blog_entry_descr .blog_entry_date { #entries .blog_entry .blog_entry_meta {
color: #555555bb; display: flex;
justify-content: flex-end;
align-items: center;
column-gap: 10px;
font-style: italic; font-style: italic;
font-size: 0.9em;
color: #555555bb; }
#entries .blog_entry .blog_entry_date {
display: block; display: block;
align-self: flex-start; } align-self: flex-start; }
#entries .blog_entry .blog_entry_tags::before {
content: "Tags:"; }
#entries .blog_entry .blog_entry_tags { #entries .blog_entry .blog_entry_tags {
list-style: none; list-style: none;
padding-left: 0; padding-left: 0;
margin: 5px 0; margin: 0; }
font-size: 0.9em; }
#entries .blog_entry .blog_entry_tags li { #entries .blog_entry .blog_entry_tags li {
display: inline; display: inline; }
font-style: italic; }
#entries .blog_entry .blog_entry_tags li ~ li::before { #entries .blog_entry .blog_entry_tags li ~ li::before {
content: ", "; } content: ", "; }
#entries .blog_entry .blog_entry_tags::before {
content: "Tags:"; }
#entries hr { #post_head {
width: 80%; margin: 20px 0; }
border-color: #555555bb; } #post_head h1 {
margin: 5px 0; }
#post_head #post_date {
text-align: right;
font-style: italic; }
#post_head #post_tags {
display: flex;
justify-content: flex-end;
list-style: none;
padding-left: 0;
margin: 5px 0; }
#post_head #post_tags::before {
content: "Tags: ";
font-style: italic;
padding-right: 1em; }
#post_head #post_tags li {
font-style: italic; }
#post_head #post_tags li ~ li::before {
content: ", "; }
#entries hr:last-child { .blog .highlight > pre {
display: none; } padding: 10px;
border-radius: 10px; }
.blog img {
display: block;
margin: 10px auto;
max-width: 80%;
max-height: 60vh;
border-radius: 10px; }
.blog blockquote {
font-style: italic;
border-left: 3px solid #8b8bbd;
padding-left: 15px;
margin-left: 25px; }
html { html {
background-color: white; } background-color: white; }