render links adds to mentioned in

This commit is contained in:
Marcell Mars 2025-04-20 00:01:16 +02:00
parent b64d06b942
commit 4d482d9908
4 changed files with 41 additions and 13 deletions

View file

@ -25,6 +25,6 @@
{{ end }}
{{end}}
<h{{ add 1 .Level }} id="{{ .Anchor | safeURL }}" class="hx css-{{ .Page.File.UniqueID }}-h{{ add 1 .Level }}"><span class="counters">{{ $counter }} </span>{{ .Text | safeHTML }}<a class="hpar" href="#{{ .Anchor | safeURL }}"></a> {{ .Page.Store.Get "level" }}</h{{ add 1 .Level }}>
<h{{ add 1 .Level }} id="{{ .Anchor | safeURL }}" class="hx css-{{ .Page.File.UniqueID }}-h{{ add 1 .Level }}"><span class="counters">{{ $counter }} </span>{{ .Text | safeHTML }}<a class="hpar" href="#{{ .Anchor | safeURL }}"></a> {{ .Page.Store.Get "level" }}</h{{ add 1 .Level }}>
{{ .Page.Store.Set "previousLevel" .Level }}

View file

@ -1,16 +1,27 @@
{{- $currentPage := .Page -}}
{{- $u := urls.Parse .Destination -}}
{{- $text := .Text -}}
{{- $destination := .Destination -}}
{{- $u := urls.Parse $destination -}}
{{- if not $u.Scheme -}}
{{- with site.GetPage .Destination -}}
{{- $backlinks := .Store.Get "backlinks" | default slice -}}
{{- $backlinks := $backlinks|append $currentPage.RelPermalink -}}
{{- .Store.Set "backlinks" ($backlinks|uniq) -}}
{{- if not $text -}}
{{- $text = .LinkTitle -}}
{{- end -}}
<span class="supt">{{- .Section -}}</span><a href="{{- .RelPermalink -}}" {{- with .Title }} title="{{ . }}"{{ end -}}>{{- $text -}}</a>
{{- end -}}
{{- if hasPrefix $destination "/library" -}}
{{- $bib := strings.TrimPrefix "/library/" $destination -}}
{{- $b := index site.Data.books.catalog $bib -}}
{{- if not $text -}}
{{- $text = $b.title|default "" -}}
{{- end -}}
<span class="supt">library</span><a href="/library/BROWSE_LIBRARY.html#/books/{{- $bib -}}">{{- $text -}}</a>
{{- end -}}
{{- else -}}
<span class="supt">www</span><a href="{{ .Destination | safeURL }}"{{- with .Title }} title="{{ . }}"{{ end -}}{{- if $u.IsAbs }} rel="external"{{ end -}}>{{- with .Text }}{{ . }}{{- end -}}</a>
{{- end -}}
<a href="{{ .Destination | safeURL }}"
{{- with .Title }} title="{{ . }}"{{ end -}}
{{- if $u.IsAbs }} rel="external"{{ end -}}
>
{{- with .Text }}{{ . }}{{ end -}}
</a>
{{- /* chomp trailing newline */ -}}

View file

@ -1,6 +1,5 @@
{{ $currentPage := . }}
{{ $currentPageGraph := $currentPage.Store.Get "graph"}}
{{ $data := (dict "allPages" site.AllPages "currentPage" $currentPage)}}
{{- with (templates.Defer (dict "data" $data)) -}}
{{ range $page := .allPages }}
@ -19,5 +18,6 @@
{{- end -}}
{{- end -}}
{{- partial "menu_isin.html" (dict "currentPage" .currentPage "isin" (.currentPage.Store.Get "isin")) -}}
{{- partial "menu_mentioned_in.html" (dict "currentPage" .currentPage "mentioned_in" (.currentPage.Store.Get "mentioned_in")) -}}
{{- $mentionedInAll := union (.currentPage.Store.Get "mentioned_in") (.currentPage.Store.Get "backlinks") -}}
{{- partial "menu_mentioned_in.html" (dict "currentPage" .currentPage "mentioned_in" ($mentionedInAll|uniq)) -}}
{{- end -}}

View file

@ -16,7 +16,6 @@ hr {
}
h1,
h2,
h3,
h4,
h5,
@ -347,6 +346,22 @@ a:hover {
cursor: pointer;
}
h2 {
font-weight: 500;
font-size: 1.6rem;
}
blockquote {
border-left: 1px red solid;
margin-left: 1rem;
margin-right: 2rem;
padding-left: 1rem;
padding-right: 2rem;
padding-top: 0.1rem;
padding-bottom: 0.1rem;
background-color: #fff9f9;
}
.header {
position: sticky;
top: 0;
@ -361,7 +376,8 @@ a:hover {
max-width: 720px;
padding-top: 0.5rem;
font-size: 1.1rem;
font-size: 1.4rem;
font-style: italic;
background-color: white;
}
@ -401,7 +417,8 @@ a:hover {
cursive;
font-size: 0.9em;
font-style: normal;
color: rgba(0, 0, 0, 0.8);
/* color: rgba(0, 0, 0, 0.8); */
color: red;
vertical-align: baseline;
position: relative;
top: -0.3em;