Styled the categories on the site
This commit is contained in:
parent
f45bdcd83c
commit
d9aec4af2c
16 changed files with 176 additions and 59 deletions
|
|
@ -1,9 +0,0 @@
|
|||
<h2>Categories</h2>
|
||||
<ul>
|
||||
{{ range .Categories }}
|
||||
<li>
|
||||
<a href="{{ url_abs .Path }}">{{ .Name }}</a> ({{ .PostCount }})
|
||||
{{ if .DescriptionBrief }}<br><small>{{ .DescriptionBrief }}</small>{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
<h2>{{ .Category.Name }}</h2>
|
||||
{{ if .DescriptionHTML }}
|
||||
<div>{{ .DescriptionHTML }}</div>
|
||||
{{ end }}
|
||||
{{ range .Posts }}
|
||||
{{ if .Post.Title }}<h3>{{ .Post.Title }}</h3>{{ end }}
|
||||
{{ .HTML }}
|
||||
<a href="{{ url_abs .Path }}">{{ format_date .Post.PublishedAt }}</a>
|
||||
{{ if .Categories }}
|
||||
<p>
|
||||
{{ range .Categories }}
|
||||
<a href="{{ url_abs (printf "/categories/%s" .Slug) }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
@ -2,5 +2,6 @@ package simplecss
|
|||
|
||||
import "embed"
|
||||
|
||||
//go:embed *.html
|
||||
//go:embed templates/*.html
|
||||
//go:embed static/*
|
||||
var FS embed.FS
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
{{ range .Posts }}
|
||||
{{ if .Post.Title }}<h3>{{ .Post.Title }}</h3>{{ end }}
|
||||
{{ .HTML }}
|
||||
<a href="{{ url_abs .Path }}">{{ format_date .Post.PublishedAt }}</a>
|
||||
{{ if .Categories }}
|
||||
<p>
|
||||
{{ range .Categories }}
|
||||
<a href="{{ url_abs (printf "/categories/%s" .Slug) }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
{{ if .Post.Title }}<h3>{{ .Post.Title }}</h3>{{ end }}
|
||||
{{ .HTML }}
|
||||
<a href="{{ url_abs .Path }}">{{ format_date .Post.PublishedAt }}</a>
|
||||
{{ if .Categories }}
|
||||
<p>
|
||||
{{ range .Categories }}
|
||||
<a href="{{ url_abs (printf "/categories/%s" .Slug) }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</p>
|
||||
{{ end }}
|
||||
55
layouts/simplecss/static/style.css
Normal file
55
layouts/simplecss/static/style.css
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
.h-entry {
|
||||
margin-block-start: 1.5rem;
|
||||
margin-block-end: 2.5rem;
|
||||
}
|
||||
|
||||
.post-meta {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.post-meta a {
|
||||
color: var(--text-light);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.post-meta a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.post-categories {
|
||||
display: inline-flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.post-categories a:before {
|
||||
content: "#";
|
||||
}
|
||||
|
||||
/* Category list */
|
||||
|
||||
ul.category-list {
|
||||
list-style: none;
|
||||
padding-inline-start: 0;
|
||||
}
|
||||
|
||||
ul.category-list li {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
||||
justify-content: start;
|
||||
gap: 4rem;
|
||||
}
|
||||
|
||||
ul.category-list span.category-list-name {
|
||||
min-width: 15vw;
|
||||
}
|
||||
|
||||
/* Category single */
|
||||
|
||||
.category-description {
|
||||
margin-block-start: 1.5rem;
|
||||
margin-block-end: 2.5rem;
|
||||
}
|
||||
10
layouts/simplecss/templates/_post_meta.html
Normal file
10
layouts/simplecss/templates/_post_meta.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<div class="post-meta">
|
||||
<a href="{{ url_abs .Path }}">{{ format_date .Post.PublishedAt }}</a>
|
||||
{{ if .Categories }}
|
||||
<div class="post-categories">
|
||||
{{ range .Categories }}
|
||||
<a href="{{ url_abs (printf "/categories/%s" .Slug) }}">{{ .Name }}</a>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
9
layouts/simplecss/templates/categories_list.html
Normal file
9
layouts/simplecss/templates/categories_list.html
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<h2>Categories</h2>
|
||||
<ul class="category-list">
|
||||
{{ range .Categories }}
|
||||
<li>
|
||||
<span class="category-list-name"><a href="{{ url_abs .Path }}">{{ .Name }}</a> ({{ .PostCount }})</span>
|
||||
{{ if .DescriptionBrief }}<small>{{ .DescriptionBrief }}</small>{{ end }}
|
||||
</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
11
layouts/simplecss/templates/categories_single.html
Normal file
11
layouts/simplecss/templates/categories_single.html
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<h2>{{ .Category.Name }}</h2>
|
||||
{{ if .DescriptionHTML }}
|
||||
<div class="notice category-description">{{ .DescriptionHTML }}</div>
|
||||
{{ end }}
|
||||
{{ range .Posts }}
|
||||
<div class="h-entry">
|
||||
{{ if .Post.Title }}<h3>{{ .Post.Title }}</h3>{{ end }}
|
||||
{{ .HTML }}
|
||||
{{ template "_post_meta.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
<link rel="alternate" type="application/rss+xml" title="RSS Feed" href="{{ url_abs "/feed.xml" }}"/>
|
||||
<link rel="alternate" type="application/json" title="JSON feed" href="{{ url_abs "/feed.json" }}"/>
|
||||
<link rel="stylesheet" href="https://cdn.simplecss.org/simple.min.css">
|
||||
<link rel="stylesheet" href="{{ url_abs "/static/style.css" }}">
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
8
layouts/simplecss/templates/posts_list.html
Normal file
8
layouts/simplecss/templates/posts_list.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{{ range .Posts }}
|
||||
<div class="h-entry">
|
||||
{{ if .Post.Title }}<h3>{{ .Post.Title }}</h3>{{ end }}
|
||||
{{ .HTML }}
|
||||
|
||||
{{ template "_post_meta.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
5
layouts/simplecss/templates/posts_single.html
Normal file
5
layouts/simplecss/templates/posts_single.html
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
<div class="h-entry">
|
||||
{{ if .Post.Title }}<h3>{{ .Post.Title }}</h3>{{ end }}
|
||||
{{ .HTML }}
|
||||
{{ template "_post_meta.html" . }}
|
||||
</div>
|
||||
Loading…
Add table
Add a link
Reference in a new issue