mirror of
https://github.com/gcushen/hugo-academic.git
synced 2025-01-09 04:05:16 +01:00
Compare commits
2 commits
8d25fbed12
...
9b3512593a
Author | SHA1 | Date | |
---|---|---|---|
|
9b3512593a | ||
|
a5aba50938 |
5 changed files with 22 additions and 34 deletions
|
@ -1,18 +1,14 @@
|
||||||
{{- $u := urls.Parse .Destination -}}
|
{{- $url_struct := urls.Parse .Destination -}}
|
||||||
{{- if or $u.IsAbs (strings.HasPrefix $u.String "#") }}
|
{{/* Ignore anchor links to other sections of the same page. */}}
|
||||||
{{- /* do nothing */}}
|
{{- if not (or $url_struct.IsAbs (strings.HasPrefix $url_struct.String "#")) }}
|
||||||
{{- else }}
|
{{- $page_path := strings.TrimPrefix "./" $url_struct.Path -}}
|
||||||
{{- with .PageInner.GetPage (strings.TrimPrefix "./" $u.Path) }}
|
{{- with .PageInner.GetPage $page_path }}
|
||||||
{{- $source := dict
|
{{- $page := dict
|
||||||
"date" ($.Page.Date.UTC.Format "2006-01-02T15:04:05-07:00")
|
"date" ($.Page.Date.UTC.Format "2006-01-02T15:04:05-07:00")
|
||||||
"linkTitle" $.Page.LinkTitle
|
"linkTitle" $.Page.LinkTitle
|
||||||
"permalink" $.Page.Permalink
|
|
||||||
"relPermalink" $.Page.RelPermalink
|
"relPermalink" $.Page.RelPermalink
|
||||||
"section" $.Page.Section
|
|
||||||
"title" $.Page.Title
|
|
||||||
"type" $.Page.Type
|
|
||||||
}}
|
}}
|
||||||
{{- $el := dict "source" $source "target" .RelPermalink }}
|
{{- $backlink := dict "page" $page "links_to" .RelPermalink }}
|
||||||
{{- site.Home.Store.Add "backlinks" (slice $el) }}
|
{{- site.Home.Store.Add "backlinks" (slice $backlink) }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -1,9 +1,2 @@
|
||||||
{{- $debug := false }}
|
{{- /* Hugo 0.126 requires a `home` layout even if it serves no purpose, otherwise shows warning */ -}}
|
||||||
{{- range site.Pages }}
|
{{- jsonify dict -}}
|
||||||
{{- $noop := .WordCount }}
|
|
||||||
{{- end }}
|
|
||||||
{{- if $debug }}
|
|
||||||
{{- jsonify (dict "indent" " ") (.Store.Get "backlinks") }}
|
|
||||||
{{- else }}
|
|
||||||
{{- jsonify (dict "indent" " ") (dict "comment" "This file is intentionally empty.") }}
|
|
||||||
{{- end }}
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
{{ if $person.work }}
|
{{ if $person.work }}
|
||||||
<div class="w-full">
|
<div class="w-full">
|
||||||
<h3 class="mb-6 text-3xl font-bold text-gray-900 dark:text-white">{{ i18n "work_experience" | default "Experience" }}</h3>
|
<h3 class="mb-6 text-3xl font-bold text-gray-900 dark:text-white">{{ i18n "experience" | default "Experience" }}</h3>
|
||||||
<ol class="relative border-s border-gray-200 dark:border-gray-700">
|
<ol class="relative border-s border-gray-200 dark:border-gray-700">
|
||||||
{{ range $idx, $key := $person.work }}
|
{{ range $idx, $key := $person.work }}
|
||||||
<li class="mb-10 ms-6">
|
<li class="mb-10 ms-6">
|
||||||
|
|
|
@ -1,20 +1,19 @@
|
||||||
{{ $show_backlinks := .Params.backlinks | default true }}
|
{{ $show_backlinks := .Params.backlinks | default true }}
|
||||||
{{ if $show_backlinks }}
|
{{ if $show_backlinks }}
|
||||||
{{- $debug := false }}
|
{{ $backlinks := site.Home.Store.Get "backlinks" | uniq }}
|
||||||
{{- $backlinks := site.Home.Store.Get "backlinks" | uniq }}
|
{{ with (where $backlinks "links_to" .RelPermalink) }}
|
||||||
{{- with (where $backlinks "target" .RelPermalink) }}
|
|
||||||
<div class="backlinks">
|
<div class="backlinks">
|
||||||
<div class="mb-1 font-semibold tracking-tight">
|
<div class="mb-1 font-semibold tracking-tight">
|
||||||
{{ or (T "backlinks") "Backlinks" }}
|
{{ (T "backlinks") | default "Backlinks" }}
|
||||||
</div>
|
</div>
|
||||||
<ul>
|
<ul>
|
||||||
{{- range (sort . "source.linkTitle" "asc") }}
|
{{ range (sort . "page.date" "desc") }}
|
||||||
<li><a href="{{ .source.relPermalink }}" class="backlink">{{ .source.linkTitle }}</a></li>
|
{{ $page := .page }}
|
||||||
{{- end }}
|
<li>
|
||||||
|
<a href="{{ $page.relPermalink }}" class="backlink">{{ $page.linkTitle }}</a>
|
||||||
|
</li>
|
||||||
|
{{ end }}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
{{- end }}
|
{{ end }}
|
||||||
{{- if $debug }}
|
|
||||||
<pre>{{ jsonify (dict "indent" " ") $backlinks }}</pre>
|
|
||||||
{{- end }}
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
{{- define "toc-headings" -}}
|
{{- define "toc-headings" -}}
|
||||||
{{- $headings := .headings -}}
|
{{- $headings := .headings -}}
|
||||||
{{- $level := .level -}}
|
{{- $level := .level -}}
|
||||||
{{- if ge $level 5 -}}
|
{{- if ge $level 4 -}}
|
||||||
{{ return }}
|
{{ return }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue