added support for menu.main and migrated old links array array to menu.icons

This commit is contained in:
Gabriele Musco 2021-04-14 11:19:13 +02:00
parent 78e9b5b361
commit 09b4084830
No known key found for this signature in database
GPG Key ID: 8539FD3454380B83
4 changed files with 94 additions and 8 deletions

View File

@ -72,12 +72,15 @@ summaryLength = 70 # number of words for article summaries
# telegram # telegram
# phone # phone
# rss # rss
links = [
["GitLab", "https://gitlab.com/gabmus"],
["GNOME", "https://gitlab.gnome.org/gabmus"], # WARNING: deprecated! Use [[menu.icons]] instead, look below
["YouTube", "https://youtube.com/TechPillsNet"], # links = [
["Email", "mailto:gabmus@disroot.org"] # ["GitLab", "https://gitlab.com/gabmus"],
] # ["GNOME", "https://gitlab.gnome.org/gabmus"],
# ["YouTube", "https://youtube.com/TechPillsNet"],
# ["Email", "mailto:gabmus@disroot.org"]
# ]
# you can customize all of the colors in this theme # you can customize all of the colors in this theme
# the values shown are the defaults # the values shown are the defaults
@ -94,6 +97,28 @@ summaryLength = 70 # number of words for article summaries
infiniteScrolling = false # activates infinite scrolling instead of regular pagination infiniteScrolling = false # activates infinite scrolling instead of regular pagination
[menu]
# these links will be added to the main navigation menu, sorted by weight
# other elements in this menu are added automatically from the "pages" folder
# the folder it will look into can be customized with the pages variable
# in params above
[[menu.main]]
identifier = "about"
name = "About"
url = "/about/"
weight = 10
# these links (menu.icons) will be added as icon links below the main nav
[[menu.icons]]
identifier = "gitlab"
name = "GitLab"
url = "https://gitlab.com/gabmus"
weight = 10
[[menu.icons]]
identifier = "gnome"
name = "GNOME GitLab"
url = "https://gitlab.gnome.org/gabmus"
weight = 20
# this section is necessary if you want infinite scrolling # this section is necessary if you want infinite scrolling
# it allows to output the article list as paged JSON so that "pages" can be retrieved via javascript # it allows to output the article list as paged JSON so that "pages" can be retrieved via javascript
[outputs] [outputs]

View File

@ -226,6 +226,7 @@ h1, h2, h3, h4, h5, h6 {
border-radius: 3px; border-radius: 3px;
color: $fg_color; color: $fg_color;
display: none; display: none;
background-color: $bg_color;
} }
&:hover { &:hover {
.pseudofont { .pseudofont {

View File

@ -14,6 +14,9 @@
{{ range $pagesList }} {{ range $pagesList }}
<li><a href="{{ .Permalink }}">{{ .Title }}</a></li> <li><a href="{{ .Permalink }}">{{ .Title }}</a></li>
{{ end }} {{ end }}
{{ range .Site.Menus.main }}
<li><a href="{{ .URL }}">{{ .Name }}</a></li>
{{ end }}
{{ if (.Site.Params.showTags | default true) }} {{ if (.Site.Params.showTags | default true) }}
<li><a href="/tags">Tags</a></li> <li><a href="/tags">Tags</a></li>
{{ end }} {{ end }}
@ -30,11 +33,14 @@
</div> </div>
<div id="links"> <div id="links">
{{ if .Site.Params.showRss | default true }} {{ if .Site.Params.showRss | default true }}
{{- partial "nerdlink" (slice "RSS" "/index.xml") -}} {{- partial "iconlink" (dict "Identifier" "rss" "Name" "RSS" "URL" "/index.xml") -}}
{{ end }} {{ end }}
{{ range .Site.Params.links }} {{ range .Site.Params.links }}
{{- partial "nerdlink" . -}} {{- partial "nerdlink" . -}}
{{ end }} {{ end }}
{{ range .Site.Menus.icons }}
{{- partial "iconlink" . -}}
{{ end }}
</div> </div>
{{- partial "inject/header-after.html" . -}} {{- partial "inject/header-after.html" . -}}
</header> </header>

View File

@ -0,0 +1,54 @@
{{ $id := (lower .Identifier) }}
<a
target="_blank"
class="nerdlink"
href="{{ .URL }}">
{{ if eq $id "gitlab" }}
&#xf296;
{{ else if eq $id "gnome" }}
&#xf7ab;
{{ else if eq $id "youtube" }}
&#xf16a;
{{ else if eq $id "email" }}
&#xf6ed;
{{ else if eq $id "twitter" }}
&#xf099;
{{ else if eq $id "instagram" }}
&#xf16d;
{{ else if eq $id "facebook" }}
&#xf09a;
{{ else if eq $id "github" }}
&#xf09b;
{{ else if eq $id "linkedin" }}
&#xf0e1;
{{ else if eq $id "telegram" }}
&#xf2c6;
{{ else if eq $id "xmpp" }}
&#xfcfd;
{{ else if eq $id "pleroma" }}
<svg class="pseudofont" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="m4.2344 3.1826e-6a1.2455 1.2455 0 0 0-1.2404 1.2455 1.2455 1.2455 0 0 0 0 0.00515v14.749h3.976v-16h-2.7305a1.2455 1.2455 0 0 0-0.00515 0zm4.7477 0v8h2.7784a1.2455 1.2455 0 0 0 1.2455-1.2455 1.2455 1.2455 0 0 0 0-0.00515v-6.7493zm0 12.024v3.976h2.7784a1.2455 1.2455 0 0 0 1.2455-1.2455 1.2455 1.2455 0 0 0 0-0.0051v-2.7254z" />
</svg>
{{ else if eq $id "peertube" }}
<svg class="pseudofont" width="16" height="16" version="1.1" viewBox="2799 -911 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="m2801-911v8l5.9998-3.9996zm5.9998 4.0004v7.9993l5.9998-3.9996-5.9998-4.0004zm-5.9998 3.9996v8l5.9998-3.9996z"/>
</svg>
{{ else if eq $id "matrix" }}
<svg class="pseudofont" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path d="m0.61133 0v16h1.6498v-0.52679h-1.0762v-14.946h1.0762v-0.52679zm13.128 0v0.52679h1.0762v14.946h-1.0762v0.52679h1.6498v-16zm-6.8306 5.0527c-0.36785 0-0.69557 0.080576-0.98047 0.24219-0.28509 0.1618-0.52842 0.38949-0.73047 0.68359h-0.021484v-0.77148h-1.4512v5.7051h1.5371v-3.3105c-1e-7 -0.27957 0.039729-0.50668 0.11914-0.67969 0.079365-0.17278 0.17514-0.30442 0.28711-0.39648 0.11173-0.091827 0.22666-0.15439 0.3457-0.1875 0.11891-0.033206 0.21487-0.050781 0.28711-0.050781 0.24522 0 0.43037 0.042632 0.55664 0.12695 0.12617 0.084749 0.21736 0.19823 0.27148 0.33789 0.054214 0.1399 0.084431 0.29138 0.091797 0.45703 0.00694 0.16546 0.00977 0.33274 0.00977 0.50195v3.2012h1.5371v-3.1777c0-0.17658 0.013679-0.35257 0.039063-0.52539 0.025197-0.17301 0.074658-0.3266 0.15039-0.46289 0.075685-0.13596 0.18087-0.24728 0.31445-0.33203 0.13349-0.08432 0.309-0.12695 0.52539-0.12695 0.21639 0 0.38741 0.038028 0.51367 0.11133 0.12608 0.073632 0.22214 0.17384 0.28711 0.29883 0.06493 0.12527 0.1026 0.27229 0.11719 0.44141 0.01445 0.16935 0.02344 0.34786 0.02344 0.53906v3.2344h1.5371v-3.8184c0-0.36802-0.05142-0.68189-0.15234-0.94336-0.10121-0.26099-0.24168-0.47277-0.42188-0.63477-0.18039-0.16185-0.39609-0.27993-0.64844-0.35352-0.25272-0.073585-0.52842-0.10938-0.82422-0.10938-0.38965 0-0.72682 0.093949-1.0117 0.28516-0.28509 0.1913-0.50997 0.41395-0.67578 0.66406-0.15151-0.35325-0.3738-0.60033-0.66602-0.74023-0.29212-0.13966-0.61338-0.20898-0.9668-0.20898z" />
</svg>
{{ else if eq $id "mastodon" }}
<svg class="pseudofont" xmlns:svg="http://www.w3.org/2000/svg" width="16" height="16" viewbox="0 0 16 16">
<path d="M 7.4779094,-1.598624e-6 C 5.5602384,0.0156984 3.7155894,0.2233384 2.6405814,0.7170384 c 0,0 -2.13206093,0.9537 -2.13206093,4.20766 0,0.74512 -0.01448,1.63603 0.0091,2.58084 0.07742,3.1821946 0.58336693,6.3183886 3.52553593,7.0971276 1.356568,0.359063 2.521335,0.434289 3.45936,0.382729 1.701085,-0.09431 2.6560206,-0.607063 2.6560206,-0.607063 l -0.05611,-1.234252 c 0,0 -1.2156316,0.383272 -2.5808476,0.33656 -1.352609,-0.04639 -2.780561,-0.145832 -2.999328,-1.80651 -0.0202,-0.145872 -0.03031,-0.301902 -0.03031,-0.465714 0,-10e-7 1.327834,0.324572 3.010574,0.40167 1.028943,0.0472 1.993827,-0.06028 2.9738766,-0.177218 1.879445,-0.224425 3.515901,-1.382448 3.721577,-2.4405646 0.32407,-1.666815 0.297376,-4.067605 0.297376,-4.067605 0,-3.25396 -2.131943,-4.20766 -2.131943,-4.20766 C 11.288476,0.2233384 9.4426784,0.0156784 7.5250084,-1.598624e-6 Z M 5.3076104,2.5424984 c 0.798781,0 1.403595,0.30701 1.803551,0.92113 l 0.388886,0.65181 0.388884,-0.65181 c 0.399875,-0.61412 1.00469,-0.92113 1.803551,-0.92113 0.6903266,0 1.2465526,0.24267 1.6713186,0.71609 0.411755,0.47342 0.61677,1.11337 0.61677,1.91862 v 3.939988 h -1.560986 v -3.824218 c 0,-0.80613 -0.339166,-1.21531 -1.0176126,-1.21531 -0.750129,0 -1.126049,0.48533 -1.126049,1.44509 v 2.09324 h -1.551753 v -2.09324 c 0,-0.95976 -0.376039,-1.44509 -1.126168,-1.44509 -0.678446,0 -1.017613,0.40918 -1.017613,1.21531 v 3.824218 h -1.560985 v -3.939988 c 0,-0.80525 0.205053,-1.4452 0.616889,-1.91862 0.424685,-0.47342 0.980911,-0.71609 1.671317,-0.71609 z" />
</svg>
{{ else if eq $id "phone" }}
&#xf095;
{{ else if eq $id "rss" }}
&#xf09e;
{{ else }}
{{ .Name }}
{{ end }}
<span>
{{ .Name }}
</span>
</a>