Clean up CSS

- Add vim folds to make organized sections
- Rename a lot of classes from post- to page-
- Generalize series CSS classes better
- Clean up navbar div structure
- Remove langpicker and most of multilingual support
- many other minor tweaks
This commit is contained in:
BBaoVanC 2023-03-24 08:49:02 -05:00
parent d34b2a56d7
commit 7bc8a4cb57
Signed by: bbaovanc
GPG Key ID: 18089E4E3CCF1D3A
33 changed files with 674 additions and 936 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
1: "enero"
2: "febrero"
3: "marzo"
4: "abril"
5: "mayo"
6: "julio"
7: "junio"
8: "agosto"
9: "septiembre"
10: "octubre"
11: "noviembre"
12: "diciembre"

View File

@ -61,10 +61,3 @@ languages:
languageName: English
title: Example Website
weight: 1
es:
languageName: Español
title: Sitio web ejemplo
weight: 2
params:
description: Sitio web ejemplo para bobatheme

View File

@ -58,8 +58,8 @@ newer_post:
# ARIA labels
aria_header_link:
other: "header link"
aria_heading_link:
other: "heading link"
aria_back_to_top_button:
other: "back to top button"
@ -70,9 +70,6 @@ aria_rss_link:
aria_post_meta_edit_history:
other: "link to page edit history"
aria_post_meta_translations:
other: "translations"
aria_post_meta_categories:
other: "categories"
@ -121,12 +118,6 @@ aria_series_metadata:
aria_navbar:
other: "navigation bar"
aria_langpicker:
other: "language picker"
aria_langpicker_list:
other: "language list"
aria_table_of_contents:
other: "table of contents"

View File

@ -1,149 +0,0 @@
# Misc
credit_comment:
other: "<!-- bobatheme está disponible en GitHub basado en la licensia MIT: https://github.com/BBaoVanC/bobatheme. -->"
table_of_contents:
other: "Índice"
browser_no_video_support:
other: "Tu navegador de internet no admite video."
latest_posts:
other: "Artículos recientes"
see_also:
other: "Véase también:"
copy_to_clipboard:
other: "Copiar"
# Meta items
long_date:
other: "{{ .Date.Day }} de {{ index .Data.meses (printf `%d` .Date.Month) }} de {{ .Date.Year }}"
wordcount:
one: "{{ . }} palabra"
other: "{{ . }} palabras"
readingtime:
one: "{{ . }} min"
other: "{{ . }} mins"
edit_history:
other: "Historial de cambios"
# Post count
no_posts:
other: "¡No hay contenido para mostrar!"
post_count:
one: "{{ . }} publicación"
other: "{{ . }} publicaciones"
# Navigation
read_more:
other: "Leer más"
related_posts:
other: "Publicaciones similares"
older_post:
other: "Más antiguo"
newer_post:
other: "Más nuevo"
# ARIA labels
# aria_header_link:
# other: "header link"
# aria_back_to_top_button:
# other: "back to top button"
# aria_rss_link:
# other: "RSS feed link"
# aria_post_meta_edit_history:
# other: "link to page edit history"
# aria_post_meta_translations:
# other: "translations"
# aria_post_meta_categories:
# other: "categories"
# aria_post_meta_tags:
# other: "tags"
# aria_post_meta_reading_time:
# other: "reading time"
# aria_post_meta_authors:
# other: "authors"
# aria_post_meta_series:
# other: "series"
# aria_breadcrumbnav:
# other: "breadcrumb navigation bar"
# aria_post_metadata:
# other: "post metadata"
# aria_author_metadata:
# other: "author metadata"
# aria_taxonomy_metadata:
# other: "taxonomy metadata"
# aria_post_meta_date:
# other: "date"
# aria_post_meta_modified_date:
# other: "last modified date"
# aria_author_post_count:
# other: "post count"
# aria_author_word_count:
# other: "word count"
# aria_taxonomy_post_count:
# other: "post count"
# aria_series_metadata:
# other: "series metadata"
# aria_navbar:
# other: "navigation bar"
# aria_langpicker:
# other: "language picker"
# aria_langpicker_list:
# other: "language list"
# aria_table_of_contents:
# other: "table of contents"
# aria_share_twitter:
# other: "share to twitter button"
# aria_share_facebook:
# other: "share to facebook button"
# aria_share_linkedin:
# other: "share to linkedin button"
# aria_share_reddit:
# other: "share to reddit button"
# aria_share_telegram:
# other: "share to telegram button"
# aria_share_print:
# other: "print article button"

View File

@ -1,7 +1,7 @@
<h{{ .Level }} id="{{ .Anchor | safeURL }}" class="section-header">
<h{{ .Level }} id="{{ .Anchor | safeURL }}" class="section-heading">
{{ .Text | safeHTML }}
<a href="#{{ .Anchor | safeURL }}">
<span class="section-header-link" aria-label="{{ i18n "aria_header_link" }}">
<a class="heading-link" href="#{{ .Anchor | safeURL }}">
<span aria-label="{{ i18n "aria_heading_link" }}">
{{ partial "icon.html" "link" }}
</span>
</a>

View File

@ -10,9 +10,7 @@
<a id="top" name="top" aria-hidden="true"></a>
<div class="top">
{{ partial "top.html" . }}
</div>
{{ partial "top.html" . }}
{{ if not .IsHome }}
{{ partial "breadcrumb.html" . }}

View File

@ -9,7 +9,7 @@
{{ . }}
{{ end }}
<div class="list-page-content">
<div class="list-page-container">
{{ with .Sections }}
<div class="sections">
{{ range . }}

View File

@ -1,12 +1,12 @@
{{ define "main" }}
<div class="post-title">
<div class="page-title">
<h1>
{{ .Title | markdownify }}
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h1>
</div>
{{ partial "post-metadata/full.html" . }}
{{ partial "page-metadata/post-full.html" . }}
{{ partial "series-box.html" . }}
{{ if .Params.Toc }}

View File

@ -1,10 +1,10 @@
<h2 class="post-title">
<h2 class="page-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
<a class="heading-link" href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "post-metadata/short.html" . }}
{{ partial "page-metadata/post-short.html" . }}
{{ with .Resources.GetMatch "feature" }}
<div class="post-media">
@ -12,7 +12,7 @@
</div>
{{ end }}
<div class="post-description">
<div class="page-description">
{{ partial "description-or-summary.html" . }}
</div>

View File

@ -11,7 +11,7 @@
<div class="page-list">
{{ with .Paginator.Pages }}
{{ range . }}
<article class="post">
<article class="page">
{{ .Render "summary" }}
</article>
{{ end }}

View File

@ -1,16 +1,14 @@
<div class="author">
<h2 class="author-name">
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
<h2 class="page-title">
<a class="heading-link" href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "post-metadata/author.html" . }}
{{ partial "page-metadata/author.html" . }}
<div class="author-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>
<div class="page-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="readmore">
<a href="{{ .Permalink }}">{{ i18n "read_more" }} &rarr;</a>
</div>

View File

@ -1,5 +1,5 @@
{{ define "main" }}
<div class="author-name">
<div class="page-title">
<h1>
{{ partial "icon.html" "user-circle" }}
{{ .Title | markdownify }}
@ -7,7 +7,7 @@
</h1>
</div>
{{ partial "post-metadata/author.html" . }}
{{ partial "page-metadata/author.html" . }}
{{ with .Content }}
{{ . }}

View File

@ -1,7 +1,7 @@
<div class="page-list">
{{ with . }}
{{ range . }}
<article class="post">
<article class="page">
{{ .Render "summary" }}
</article>
{{ end }}

View File

@ -1,16 +1,16 @@
<div class="author-metadata" aria-label="{{ i18n "aria_author_metadata" }}">
<div class="page-metadata" aria-label="{{ i18n "aria_author_metadata" }}">
{{/* Calculate the total word count */}}
{{ $total_words := 0 }}
{{ range .Data.Pages }}
{{ $total_words = add $total_words .WordCount }}
{{ end }}
<span class="author-meta-item" aria-label="{{ i18n "aria_author_post_count" }}">
<span class="page-metadata-item" aria-label="{{ i18n "aria_author_post_count" }}">
{{ partial "icon.html" "newspaper" }}
{{ i18n "post_count" (len .Data.Pages) }}
</span>
<span class="author-meta-item" aria-label="{{ i18n "aria_author_word_count" }}">
<span class="page-metadata-item" aria-label="{{ i18n "aria_author_word_count" }}">
{{ partial "icon.html" "align-left" }}
{{ i18n "wordcount" $total_words }}
</span>

View File

@ -1,5 +1,5 @@
{{ with .Params.authors }}
<span class="post-meta-item" aria-label="{{ i18n "aria_post_meta_authors" }}">
<span class="page-metadata-item" aria-label="{{ i18n "aria_post_meta_authors" }}">
{{ partial "icon.html" "user-circle" }}
{{ if index $.Site.Taxonomies "authors" }}

View File

@ -4,7 +4,7 @@
{{ $categories = $categories | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
{{ end }}
<div class="categories" aria-label="{{ i18n "aria_post_meta_categories" }}">
<div class="page-metadata-section categories" aria-label="{{ i18n "aria_post_meta_categories" }}">
{{ partial "icon.html" "folder" }}
{{ delimit $categories ", " }}
</div>

View File

@ -1,5 +1,5 @@
{{ if and .Site.Params.gitHistoryURL .File.Path }}
<span class="post-meta-item post-meta-edit-history" aria-label="{{ i18n "aria_post_meta_edit_history" }}">
<span class="page-metadata-item post-meta-edit-history" aria-label="{{ i18n "aria_post_meta_edit_history" }}">
{{ partial "icon.html" "history" }}
<a href="{{ printf "%s/content/%s" .Site.Params.gitHistoryURL .File.Path }}" target="_blank" rel="noopener">
{{- i18n "edit_history" -}}

View File

@ -1,5 +1,5 @@
{{ if ne .Site.Params.readingtime false }}
<span class="post-meta-item" aria-label="{{ i18n "aria_post_meta_reading_time" }}">
<span class="page-metadata-item" aria-label="{{ i18n "aria_post_meta_reading_time" }}">
{{ partial "icon.html" "clock" }}
{{ i18n "readingtime" .ReadingTime }}
</span>

View File

@ -4,7 +4,7 @@
{{ $series = $series | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
{{ end }}
<div class="series" aria-label="{{ i18n "aria_post_meta_series" }}">
<div class="page-metadata-section series" aria-label="{{ i18n "aria_post_meta_series" }}">
{{ partial "icon.html" "files" }}
{{ delimit $series ", " }}
</div>

View File

@ -4,7 +4,7 @@
{{ $tags = $tags | append (printf `<a href="%s">%s</a>` .Permalink .LinkTitle) }}
{{ end }}
<div class="tags" aria-label="{{ i18n "aria_post_meta_tags" }}">
<div class="page-metadata-section tags" aria-label="{{ i18n "aria_post_meta_tags" }}">
{{ partial "icon.html" "tag" }}
{{ delimit $tags ", " }}
</div>

View File

@ -1,7 +1,7 @@
{{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime .Site.Params.gitFileURL }}
<div class="post-metadata" aria-label="{{ i18n "aria_post_metadata" }}">
{{ if or .Date .Params.authors .Site.Params.readingtime .Site.Params.gitFileURL }}
<div class="page-metadata" aria-label="{{ i18n "aria_post_metadata" }}">
{{ if .Date }}
<span class="post-meta-item" aria-label="{{ i18n "aria_post_meta_date" }}">
<span class="page-metadata-item" aria-label="{{ i18n "aria_post_meta_date" }}">
{{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
@ -11,7 +11,7 @@
{{/* TODO: make this be a tooltip */}}
{{/* DISABLED
{{ if ne (time.Format "2006-01-02" .Lastmod) (time.Format "2006-01-02" .Date) }}
<span class="post-meta-item" aria-label="{{ i18n "aria_post_meta_modified_date" }}">
<span class="page-metadata-item" aria-label="{{ i18n "aria_post_meta_modified_date" }}">
{{ partial "icon.html" "pencil" }}
<time datetime="{{ .Lastmod.Format "2006-01-02" }}" pubdate>
{{ i18n "long_date" (dict "Date" .Lastmod "Data" .Site.Data) }}
@ -21,11 +21,10 @@
*/}}
{{ end }}
{{ partial "post-meta-item/authors.html" . }}
{{ partial "post-meta-item/translations.html" . }}
{{ partial "post-meta-item/readingtime.html" . }}
{{ partial "post-meta-item/edithistory.html" . }}
{{ partial "post-meta-item/categories.html" . }}
{{ partial "post-meta-item/tags.html" . }}
{{ partial "page-metadata/item/authors.html" . }}
{{ partial "page-metadata/item/readingtime.html" . }}
{{ partial "page-metadata/item/edithistory.html" . }}
{{ partial "page-metadata/item/categories.html" . }}
{{ partial "page-metadata/item/tags.html" . }}
</div>
{{ end }}

View File

@ -0,0 +1,18 @@
{{ if or .Date .Params.authors .Site.Params.readingtime }}
<div class="page-metadata" aria-label="{{ i18n "aria_post_metadata" }}">
{{ if .Date }}
<span class="page-metadata-item" aria-label="date">
{{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
</time>
</span>
{{ end }}
{{ partial "page-metadata/item/authors.html" . }}
{{ partial "page-metadata/item/readingtime.html" . }}
{{ partial "page-metadata/item/series.html" . }}
{{ partial "page-metadata/item/categories.html" . }}
{{ partial "page-metadata/item/tags.html" . }}
</div>
{{ end }}

View File

@ -1,11 +1,11 @@
<div class="post-metadata" aria-label="{{ i18n "aria_series_metadata" }}">
<span class="post-meta-item">
<div class="page-metadata" aria-label="{{ i18n "aria_series_metadata" }}">
<span class="page-metadata-item">
{{ partial "icon.html" "newspaper" }}
{{ i18n "post_count" (len .Data.Pages) }}
</span>
{{ if ne .Site.Params.readingtime false }}
<span class="post-meta-item">
<span class="page-metadata-item">
{{ partial "icon.html" "clock" }}
{{ $readingtime := 0 }}
{{ range .Data.Pages }}
@ -14,6 +14,4 @@
{{ i18n "readingtime" $readingtime }}
</span>
{{ end }}
{{ partial "post-meta-item/translations.html" . }}
</div>

View File

@ -1,8 +0,0 @@
{{ if .IsTranslated }}
<span class="post-meta-item" aria-label="{{ i18n "aria_post_meta_translations" }}">
{{ partial "icon.html" "world" }}
{{ range .Translations }}
<a href="{{ .Permalink }}">{{ .Language }}</a>
{{ end }}
</span>
{{ end }}

View File

@ -1,19 +0,0 @@
{{ if or .Date .Params.authors .IsTranslated .Site.Params.readingtime }}
<div class="post-metadata" aria-label="{{ i18n "aria_post_metadata" }}">
{{ if .Date }}
<span class="post-meta-item" aria-label="date">
{{ partial "icon.html" "calendar" }}
<time datetime="{{ .Date.Format "2006-01-02" }}" pubdate>
{{ i18n "long_date" (dict "Date" .Date "Data" .Site.Data) }}
</time>
</span>
{{ end }}
{{ partial "post-meta-item/authors.html" . }}
{{ 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 }}

View File

@ -1,54 +1,21 @@
<header class="header">
<a href="{{ .Site.Home.Permalink | absLangURL }}">
<a class="heading-link" href="{{ .Site.Home.Permalink | absLangURL }}">
{{ .Site.Title | markdownify }}
</a>
</header>
<div class="topbar">
<nav class="navbar" aria-label="{{ i18n "aria_navbar" }}">
{{ with .Site.Home }}
<a class="navbar-item{{ if $.IsHome }} active{{ end }}" href="{{ .Permalink | absLangURL }}">{{ .Title | markdownify }}</a>
{{ end }}
{{ range .Site.Menus.main }}
{{ $isActive := false }}
{{ if or ($.HasMenuCurrent .Menu .) ($.IsMenuCurrent .Menu .) }}
{{ $isActive = true }}
{{ end }}
<a class="navbar-item{{ if $isActive }} active{{ end }}"
{{ if strings.HasPrefix .URL "http" }}target="_blank" rel="noopener"{{ end }}
href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</nav>
{{ if .Site.IsMultiLingual }}
<details class="langpicker" aria-label="{{ i18n "aria_langpicker" }}">
<summary>
{{- partial "icon.html" "world" -}}
</summary>
<ul class="languages" aria-label="{{ i18n "aria_langpicker_list" }}">
{{ range .AllTranslations }}
<li>
<a class="langpicker-item{{ if eq .Language $.Site.Language }} active{{ end }}" href="{{ .Permalink }}">{{ .Language.LanguageName }}</a>
</li>
{{ end }}
{{ $site_translations := slice }}
{{ range .Site.Languages }}
{{ $site_translations = $site_translations | append .LanguageName }}
{{ end }}
{{ $translation_codes := slice }}
{{ range .AllTranslations }}
{{ $translation_codes = $translation_codes | append .Language }}
{{ end }}
{{ range (.Site.Languages | complement $translation_codes) }}
<li>
<a class="langpicker-item unavailable" aria-disabled="true">{{ .LanguageName }}</a>
</li>
{{ end }}
</ul>
</details>
<nav class="navbar" aria-label="{{ i18n "aria_navbar" }}">
{{ with .Site.Home }}
<a class="navbar-item{{ if $.IsHome }} active{{ end }}" href="{{ .Permalink | absLangURL }}">{{ .Title | markdownify }}</a>
{{ end }}
</div>
{{ range .Site.Menus.main }}
{{ $isActive := false }}
{{ if or ($.HasMenuCurrent .Menu .) ($.IsMenuCurrent .Menu .) }}
{{ $isActive = true }}
{{ end }}
<a class="navbar-item{{ if $isActive }} active{{ end }}"
{{ if strings.HasPrefix .URL "http" }}target="_blank" rel="noopener"{{ end }}
href="{{ .URL }}">{{ .Name }}</a>
{{ end }}
</nav>

View File

@ -8,12 +8,12 @@
{{ . }}
{{ end }}
<div class="series-taxonomy-list">
{{ with .Pages }}
<div class="page-list series">
{{ with .Paginator.Pages }}
{{ range . }}
<article class="series-taxonomy">
<div class="page series">
{{ .Render "summary" }}
</article>
</div>
{{ end }}
{{ else }}
<div>

View File

@ -1,18 +1,18 @@
<h2 class="post-title">
<h2 class="page-title">
{{ with .Parent.Params.icon }}{{ partial "icon.html" . }}{{ end }}
<a href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
<a class="heading-link" href="{{ .Permalink }}">{{ .Title | markdownify }}</a>
{{ if .Draft }}{{ partial "icon.html" "write" }}{{ end }}
</h2>
{{ partial "post-metadata/series.html" . }}
{{ partial "page-metadata/series.html" . }}
<div class="post-description">
<div class="page-description">
{{ partial "description-or-summary.html" . }}
</div>
<div class="series-page-list">
<div class="page-list series-inner">
{{ range .Data.Pages.Reverse }}
<article class="post">
<article class="page">
{{ .Render "summary" }}
</article>
{{ end }}

View File

@ -5,7 +5,7 @@
{{ partial "rss-link.html" . }}
</h1>
{{ partial "post-metadata/series.html" . }}
{{ partial "page-metadata/series.html" . }}
{{ with .Content }}
{{ . }}

View File

@ -1,5 +1,5 @@
{{ define "main" }}
<div class="post-title">
<div class="page-title">
<h1>
{{ if eq .Data.Singular "tag" }}
{{ partial "icon.html" "tag" }}
@ -26,7 +26,7 @@
<a href="{{ .Permalink }}">
<p>{{ .Title | markdownify }}</p>
</a>
{{ partial "post-metadata/taxonomy.html" . }}
{{ partial "page-metadata/taxonomy.html" . }}
</div>
{{ partial "description-or-summary.html" . }}
</article>

View File

@ -1,5 +1,5 @@
{{ define "main" }}
<div class="post-title">
<div class="page-title">
<h1>
{{ if eq .Data.Singular "tag" }}
{{ partial "icon.html" "tag" }}
@ -14,7 +14,7 @@
</h1>
</div>
{{ partial "post-metadata/taxonomy.html" . }}
{{ partial "page-metadata/taxonomy.html" . }}
{{ with .Content }}
{{ . }}