]> Untitled Git - bitcoindevkit.org/commitdiff
Show author on blogposts, fix layouts
authorAlekos Filini <alekos.filini@gmail.com>
Wed, 18 Nov 2020 18:12:20 +0000 (19:12 +0100)
committerAlekos Filini <alekos.filini@gmail.com>
Wed, 18 Nov 2020 18:12:20 +0000 (19:12 +0100)
layouts/partials/header.html [new file with mode: 0644]
layouts/partials/menu.html [new file with mode: 0644]
static/css/blog.css
themes/learn

diff --git a/layouts/partials/header.html b/layouts/partials/header.html
new file mode 100644 (file)
index 0000000..3e9a778
--- /dev/null
@@ -0,0 +1,121 @@
+<!-- Copied from themes/learn/layout/partials/header.html. Adds the logic to handle blog posts (author name) -->
+
+<!DOCTYPE html>
+<html lang="{{ .Page.Language | default "en" }}" class="js csstransforms3d">
+  <head>
+    <meta charset="utf-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    {{ hugo.Generator }}
+    {{ partial "meta.html" . }}
+    {{ partial "favicon.html" . }}
+    <title>{{ .Title }} {{ default "::" .Site.Params.titleSeparator }} {{ .Site.Title }}</title>
+
+    {{ $assetBusting := not .Site.Params.disableAssetsBusting }}
+    <link href="{{"css/nucleus.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    <link href="{{"css/fontawesome-all.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    <link href="{{"css/hybrid.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    <link href="{{"css/featherlight.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    <link href="{{"css/perfect-scrollbar.min.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    <link href="{{"css/auto-complete.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    <link href="{{"css/atom-one-dark-reasonable.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    <link href="{{"css/theme.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    <link href="{{"css/hugo-theme.css" | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    {{with .Site.Params.themeVariant}}
+    <link href="{{(printf "css/theme-%s.css" .) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    {{end}}
+    {{ range .Site.Params.custom_css -}}
+    <link href="{{(printf "%s" .) | relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
+    {{- end }}
+
+    <script src="{{"js/jquery-3.3.1.min.js"| relURL}}{{ if $assetBusting }}?{{ now.Unix }}{{ end }}"></script>
+
+    <style>
+      :root #header + #content > #left > #rlblock_left{
+          display:none !important;
+      }
+      {{ if .Site.Params.disableInlineCopyToClipBoard }}
+        :not(pre) > code + span.copy-to-clipboard {
+            display: none;
+        }
+      {{ end }}
+    </style>
+    {{ partial "custom-header.html" . }}
+  </head>
+  <body class="" data-url="{{ .RelPermalink }}">
+    {{ partial "menu.html" . }}
+        <section id="body">
+        <div id="overlay"></div>
+        <div class="padding highlightable">
+              {{if not .IsHome}}
+              <div>
+                <div id="top-bar">
+                {{ if and (or .IsPage .IsSection) .Site.Params.editURL }}
+                  {{ $File := .File }}
+                  {{ $Site := .Site }}
+                  {{with $File.Path }}
+                  <div id="top-github-link">
+                    <a class="github-link" title='{{T "Edit-this-page"}}' href="{{ $Site.Params.editURL }}{{ replace $File.Dir "\\" "/" }}{{ $File.LogicalName }}" target="blank">
+                      <i class="fas fa-code-branch"></i>
+                      <span id="top-github-link-text">{{T "Edit-this-page"}}</span>
+                    </a>
+                  </div>
+                  {{ end }}
+                {{ end }}
+                {{$toc := (and (not .Params.disableToc) (not .Params.chapter))}}
+                <div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
+                    <span id="sidebar-toggle-span">
+                        <a href="#" id="sidebar-toggle" data-sidebar-toggle="">
+                          <i class="fas fa-bars"></i>
+                        </a>
+                    </span>
+                  {{ if $toc }}
+                  <span id="toc-menu"><i class="fas fa-list-alt"></i></span>
+                  {{ end }}
+                  <span class="links">
+                 {{$showBreadcrumb := (and (not .Params.disableBreadcrumb) (not .Site.Params.disableBreadcrumb))}}
+                 {{if $showBreadcrumb}}
+                    {{ template "breadcrumb" dict "page" . "value" .Title }}
+                 {{ else }}
+                   {{ .Title }}
+                 {{ end }}
+                  </span>
+                </div>
+                {{ if $toc }}
+                    {{ partial "toc.html" . }}
+                {{ end }}
+              </div>
+            </div>
+            {{ end }}
+        <div id="head-tags">
+        {{ partial "tags.html" . }}
+        </div>
+        {{ if .Params.chapter }}
+          <div id="chapter">
+        {{ end }}
+        <div id="body-inner">
+          {{if and (not .IsHome) (not .Params.chapter) }}
+            {{ if (eq .Type "blog") }}
+            <h1 class="blog-title">{{ .Title }} </h1>
+                {{ if isset .Params "author" }}
+                    <span class="blog-author">By <a href="{{ "/blog/author/" | relLangURL }}{{ .Params.author | urlize }}">{{ .Params.author }}</a></span>
+                    <hr>
+                {{ end }}
+            {{ else }}
+            <h1>
+              {{ if or (eq .Kind "taxonomy") (eq .Kind "term") }}
+                {{.Data.Singular}} ::
+              {{ end }}
+              {{.Title}}
+            </h1>
+            {{ end }}
+          {{end}}
+
+        {{define "breadcrumb"}}
+          {{$parent := .page.Parent }}
+          {{ if $parent }}
+            {{ $value := (printf "<a href='%s'>%s</a> > %s" $parent.RelPermalink $parent.Title .value) }}
+            {{ template "breadcrumb" dict "page" $parent "value" $value }}
+          {{else}}
+            {{.value|safeHTML}}
+          {{end}}
+        {{end}}
diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html
new file mode 100644 (file)
index 0000000..551b63c
--- /dev/null
@@ -0,0 +1,155 @@
+<!-- Copied from themes/learn/layout/partials/menu.html to remove the empty <ul></ul> when all the items in a menu are hidden -->
+<!-- Switch back to the original once https://github.com/matcornic/hugo-theme-learn/pull/470 is merged -->
+
+<nav id="sidebar" class="{{if $.Site.Params.showVisitedLinks }}showVisitedLinks{{end}}">
+
+{{ $currentNode := . }}
+{{ $showvisitedlinks := .Site.Params.showVisitedLinks }}
+  <div id="header-wrapper">
+    <div id="header">
+      {{ partial "logo.html" . }}
+    </div>
+    {{if not .Site.Params.disableSearch}}
+        {{ partial "search.html" . }}
+    {{end}}
+  </div>
+
+    <div class="highlightable">
+    <ul class="topics">
+
+        {{if eq .Site.Params.ordersectionsby "title"}}  
+          {{range .Site.Home.Sections.ByTitle}}
+          {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}}
+          {{end}}
+        {{else}}
+          {{range .Site.Home.Sections.ByWeight}}
+          {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}}
+          {{end}}
+        {{end}} 
+    </ul>
+
+    {{ $disableShortcutsTitle := .Site.Params.DisableShortcutsTitle}}
+    {{with .Site.Menus.shortcuts}}
+      <section id="shortcuts">
+        <h3>{{ if not $disableShortcutsTitle}}{{ T "Shortcuts-Title"}}{{ end }}</h3>
+        <ul>
+          {{ range sort . "Weight"}}
+              <li> 
+                  {{.Pre}}<a class="padding" href="{{.URL | absLangURL }}">{{safeHTML .Name}}</a>{{.Post}}
+              </li>
+          {{end}}
+        </ul>
+      </section>
+    {{end}}
+
+    {{ if or .Site.IsMultiLingual $showvisitedlinks }}
+    <section id="prefooter">
+      <hr/>
+      <ul>
+      {{ if and .Site.IsMultiLingual (not .Site.Params.DisableLanguageSwitchingButton)}}
+        <li>
+          <a class="padding">
+            <i class="fas fa-language fa-fw"></i>
+          <div class="select-style">
+            <select id="select-language" onchange="location = this.value;">
+          {{ $siteLanguages := .Site.Languages}}
+          {{ $pageLang := .Page.Lang}}
+          {{ range .Page.AllTranslations }}
+              {{ $translation := .}}
+              {{ range $siteLanguages }}
+                  {{ if eq $translation.Lang .Lang }}
+                    {{ $selected := false }}
+                    {{ if eq $pageLang .Lang}}
+                      <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}" selected>{{ .LanguageName }}</option>
+                    {{ else }}
+                      <option id="{{ $translation.Language }}" value="{{ $translation.Permalink }}">{{ .LanguageName }}</option>
+                    {{ end }}
+                  {{ end }}
+              {{ end }}
+          {{ end }}
+        </select>
+        <svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+          width="255px" height="255px" viewBox="0 0 255 255" style="enable-background:new 0 0 255 255;" xml:space="preserve">
+          <g>
+            <g id="arrow-drop-down">
+              <polygon points="0,63.75 127.5,191.25 255,63.75          " />
+            </g>
+          </g>
+        </svg>
+        </div>
+        </a>
+        </li>
+      {{end}}
+      
+      {{ if $showvisitedlinks}}
+        <li><a class="padding" href="#" data-clear-history-toggle=""><i class="fas fa-history fa-fw"></i> {{T "Clear-History"}}</a></li>
+      {{ end }}
+      </ul>
+    </section>
+    {{ end }}
+    <section id="footer">
+      {{ partial "menu-footer.html" . }}
+    </section>
+  </div>
+</nav>
+
+<!-- templates -->
+{{ define "section-tree-nav" }}
+{{ $showvisitedlinks := .showvisitedlinks }}
+{{ $currentNode := .currentnode }}
+{{ $currentFileUniqueID := "" }}
+{{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }}
+ {{with .sect}}
+  {{if and .IsSection (or (not .Params.hidden) $.showhidden)}}
+    {{safeHTML .Params.head}}
+    <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item 
+        {{if .IsAncestor $currentNode }}parent{{end}}
+        {{if eq .File.UniqueID $currentFileUniqueID}}active{{end}}
+        {{if .Params.alwaysopen}}parent{{end}}
+        ">
+      <a href="{{.RelPermalink}}">
+          {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
+          {{ if $showvisitedlinks}}
+            <i class="fas fa-check read-icon"></i>
+          {{ end }}
+      </a>
+      {{ $numberOfPages := (add (len ( where .Pages "Params.hidden" "ne" true )) (len ( where .Sections "Params.hidden" "ne" true ))) }}
+      {{ if ne $numberOfPages 0 }}
+        <ul>
+          {{ $currentNode.Scratch.Set "pages" .Pages }}
+          {{ if .Sections}}
+            {{ $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }}
+          {{end}}
+          {{ $pages := ($currentNode.Scratch.Get "pages") }}
+          
+        {{if eq .Site.Params.ordersectionsby "title"}}  
+          {{ range $pages.ByTitle }}
+            {{ if and .Params.hidden (not $.showhidden) }} 
+            {{else}}
+            {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }}
+            {{end}}
+          {{ end }}
+        {{else}}
+          {{ range $pages.ByWeight }}
+            <li>{{ .Pages }}</li>
+            {{ if and .Params.hidden (not $.showhidden) }} 
+            {{else}}
+            {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }}
+            {{end}}
+          {{ end }}
+        {{end}}
+        </ul>
+      {{ end }}        
+    </li>
+  {{else}}
+    {{ if not .Params.Hidden }}
+      <li data-nav-id="{{.RelPermalink}}" title="{{.Title}}" class="dd-item {{if eq .File.UniqueID $currentFileUniqueID}}active{{end}}">
+        <a href="{{ .RelPermalink}}">
+        {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}}
+        {{ if $showvisitedlinks}}<i class="fas fa-check read-icon"></i>{{end}}
+        </a>
+    </li>
+     {{ end }}
+  {{end}}
+ {{ end }}
+{{ end }}
index fe479652a88661a77c0f5cd422503d96c88416fc..b0c60eda8e0666131cb1fe6e4806b4c0043dcc29 100644 (file)
@@ -1,3 +1,18 @@
+h1.blog-title {
+    margin-top: 0;
+    margin-bottom: 0;
+}
+
+span.blog-author {
+    font-weight: bolder;
+    font-size: 1.2em;
+}
+
+div.tags {
+    display: flex;
+    justify-content: center;
+}
+
 h3.blog-post {
     display: flex;
     align-items: center;
@@ -16,6 +31,10 @@ span.blog-post-tags {
 }
 
 a.tag-link::before {
-    left: calc(-1em + 0.5px) !important;
-    top: 0.5px !important;
+    width: 1em !important;
+    height: 2em !important;
+}
+
+a.tag-link {
+    border-radius: 1px 3px 3px 1px !important;
 }
index 023fe7ef2b4c45fe66ac932d9e25d09f30b74a4e..ae732f39317e4619770bc086e08ac21a256fa0e3 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 023fe7ef2b4c45fe66ac932d9e25d09f30b74a4e
+Subproject commit ae732f39317e4619770bc086e08ac21a256fa0e3