diff --git a/exampleSite/content/links.md b/exampleSite/content/links.md new file mode 100644 index 00000000..dc0b20e7 --- /dev/null +++ b/exampleSite/content/links.md @@ -0,0 +1,5 @@ +--- +layout: linktree +links: + - "Awesome Master Class": "https://example.com" +--- \ No newline at end of file diff --git a/layouts/_default/linktree.html b/layouts/_default/linktree.html new file mode 100644 index 00000000..7127b103 --- /dev/null +++ b/layouts/_default/linktree.html @@ -0,0 +1,20 @@ +{{ define "main" }} +
+ {{ .Params.Author.name }} + {{ with .Site.Params.Author.name | markdownify }} +
+ {{ . }} +
+ {{ end }} +
+
+
+

+ {{ .Title | emojify }} +

+
+
+ {{ partial "linktree_list.html" . }} +
+
+{{ end }} \ No newline at end of file diff --git a/layouts/partials/linktree-list.html b/layouts/partials/linktree-list.html new file mode 100644 index 00000000..f755c851 --- /dev/null +++ b/layouts/partials/linktree-list.html @@ -0,0 +1,34 @@ +
+
+ {{ $siteLinks := .Site.Params.Author.Links | default (slice) }} + {{ $pageLinks := .Params.Links | default (slice) }} + {{ $allLinks := slice }} + + {{ range $link := $pageLinks }} + {{ $allLinks = $allLinks | append $link }} + {{ end }} + + {{ range $link := $siteLinks }} + {{ $allLinks = $allLinks | append $link }} + {{ end }} + + {{ if gt (len $allLinks) 0 }} + {{ range $links := $allLinks }} + {{ range $name, $url := $links }} + + {{ $icon := resources.Get (print "icons/" $name ".svg") }} + {{ if $icon }} + + {{ $icon.Content | safeHTML }} + + {{ end }} + {{ $name }} + + {{ end }} + {{ end }} + {{ else }} +

No links configured.

+ {{ end }} +
+
+ \ No newline at end of file