meleu
2022-04-02 a469653f7575ae604ec3e979768f4ddfecf5e2b5
layouts/partials/backlinks.html
@@ -3,20 +3,22 @@
    {{$url := urls.Parse .Site.BaseURL }}
    {{$host := strings.TrimRight "/" $url.Path }}
    {{$curPage := strings.TrimPrefix $host (strings.TrimRight "/" .Page.RelPermalink) }}
    {{$inbound := index $.Site.Data.linkIndex.index.backlinks $curPage}}
    {{$linkIndex := getJSON "/assets/indices/linkIndex.json"}}
    {{$inbound := index $linkIndex.index.backlinks $curPage}}
    {{$contentTable := getJSON "/assets/indices/contentIndex.json"}}
    {{if $inbound}}
    {{- range $inbound -}}
        {{$src := index . "source"}}
        {{$src = replace $src " " "-"}}
        {{$src = replace $src `\` ""}}
        <li>
            <a href="../{{$src | safeHTML}}">{{index . "source"}}</a>
        </li>
    {{$cleanedInbound := apply (apply $inbound "index" "." "source") "replace" "." " " "-"}}
    {{- range $cleanedInbound | uniq -}}
      {{$l := .}}
      {{with (index $contentTable .)}}
      <li>
          <a href="{{$l}}">{{index (index . "title")}}</a>
      </li>
      {{end}}
    {{- end -}}
    {{else}}
    <li>
        No backlinks found
    </li>
    {{end}}
</ul>
</ul>