mirror of
https://github.com/BBaoVanC/bobatheme.git
synced 2024-11-17 05:15:58 -06:00
Support categories again, but hopefully a bit better
This commit is contained in:
parent
0888356292
commit
311d846cb8
@ -10,6 +10,9 @@ draft: true
|
||||
authors:
|
||||
- {{ with .Site.Author.name }}{{ . }}{{ else }}John Doe{{ end }}
|
||||
|
||||
categories:
|
||||
- archetype-stuff
|
||||
|
||||
tags:
|
||||
- awesome
|
||||
|
||||
|
15
archetypes/categories/_index.md
Normal file
15
archetypes/categories/_index.md
Normal file
@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
title: {{ replace .Name "-" " " | title }}
|
||||
|
||||
---
|
||||
|
||||
A short summary of what the category is about.
|
||||
|
||||
<!--more-->
|
||||
|
||||
Optionally provide more information about the category here. This part will only
|
||||
show on the category page, not on the category list page.
|
||||
|
||||
If you delete this section, DO NOT delete the summary separator (`<!--more-->`)
|
||||
or else the summary won't be shown.
|
@ -113,6 +113,7 @@
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.categories,
|
||||
.tags,
|
||||
.series {
|
||||
margin-top: 10px;
|
||||
@ -133,6 +134,41 @@
|
||||
|
||||
|
||||
|
||||
/* Category list format */
|
||||
.category-list ul {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
list-style: none;
|
||||
gap: 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.category-list li {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
gap: 20px;
|
||||
background-color: var(--background-2);
|
||||
padding: 8px 12px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
@media (max-width: 360px) {
|
||||
.category-list li {
|
||||
flex-direction: column;
|
||||
gap: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.category-list li > a,
|
||||
.category-list li > p {
|
||||
}
|
||||
|
||||
.category-list p {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Tags list format */
|
||||
.tag-list ul {
|
||||
display: flex;
|
||||
|
@ -7,6 +7,7 @@ params:
|
||||
readingtime: true
|
||||
|
||||
taxonomies:
|
||||
category: categories
|
||||
tag: tags
|
||||
author: authors
|
||||
series: series
|
||||
|
27
layouts/categories/list.html
Normal file
27
layouts/categories/list.html
Normal file
@ -0,0 +1,27 @@
|
||||
{{ define "main" }}
|
||||
<h1>
|
||||
{{ partial "icon.html" "folder" }}
|
||||
{{ .Title | markdownify }}
|
||||
</h1>
|
||||
|
||||
<div class="category-list">
|
||||
{{ with .Data.Terms.Alphabetical }}
|
||||
<ul>
|
||||
{{ range . }}
|
||||
{{ with .Page }}
|
||||
<li>
|
||||
<a href="{{ .Permalink }}">
|
||||
<p>{{ .Title | markdownify }}</p>
|
||||
</a>
|
||||
{{ partial "description-or-summary.html" . }}
|
||||
</li>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ else }}
|
||||
<div>
|
||||
{{ i18n "no_posts" }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ end }}
|
27
layouts/categories/term.html
Normal file
27
layouts/categories/term.html
Normal file
@ -0,0 +1,27 @@
|
||||
{{ define "main" }}
|
||||
<h1>
|
||||
{{ partial "icon.html" "folder" }}
|
||||
{{ .Title | markdownify }}
|
||||
{{ partial "rss-link.html" . }}
|
||||
</h1>
|
||||
|
||||
{{ with .Content }}
|
||||
{{ . }}
|
||||
{{ end }}
|
||||
|
||||
<div class="page-list">
|
||||
{{ with .Paginator.Pages }}
|
||||
<ul>
|
||||
{{ range . }}
|
||||
<li>{{ .Render "summary/post" }}</li>
|
||||
{{ end }}
|
||||
</ul>
|
||||
{{ else }}
|
||||
<div>
|
||||
{{ i18n "no_posts" }}
|
||||
</div>
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
{{ partial "pagination.html" . }}
|
||||
{{ end }}
|
11
layouts/partials/post-meta-item/categories.html
Normal file
11
layouts/partials/post-meta-item/categories.html
Normal file
@ -0,0 +1,11 @@
|
||||
{{ with (.GetTerms "categories") }}
|
||||
{{ $categories := slice }}
|
||||
{{ range . }}
|
||||
{{ $categories = $categories | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
|
||||
{{ end }}
|
||||
|
||||
<div class="categories" aria-label="{{ i18n "aria_post_meta_categories" }}">
|
||||
{{ partial "icon.html" "folder" }}
|
||||
{{ delimit $categories ", " }}
|
||||
</div>
|
||||
{{ end }}
|
@ -25,6 +25,7 @@
|
||||
{{ partial "post-meta-item/translations.html" . }}
|
||||
{{ partial "post-meta-item/readingtime.html" . }}
|
||||
{{ partial "post-meta-item/viewsource.html" . }}
|
||||
{{ partial "post-meta-item/categories.html" . }}
|
||||
{{ partial "post-meta-item/tags.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
@ -13,6 +13,7 @@
|
||||
{{ partial "post-meta-item/translations.html" . }}
|
||||
{{ partial "post-meta-item/readingtime.html" . }}
|
||||
{{ partial "post-meta-item/series.html" . }}
|
||||
{{ partial "post-meta-item/categories.html" . }}
|
||||
{{ partial "post-meta-item/tags.html" . }}
|
||||
</div>
|
||||
{{ end }}
|
||||
|
Loading…
Reference in New Issue
Block a user