From 44be73a11c3ccdc5021c5f4388e74fc7df958614 Mon Sep 17 00:00:00 2001 From: David Gunter Date: Sat, 18 Apr 2020 18:00:18 -0700 Subject: [PATCH] Use a partial to render social profile links. The .personalize.toml now requires all social profile links be TOML table entries. --- .personalize.toml | 26 +++++++++++++++++--------- layouts/index.html | 30 ++++-------------------------- layouts/partials/profile_link.html | 6 ++++++ 3 files changed, 27 insertions(+), 35 deletions(-) create mode 100644 layouts/partials/profile_link.html diff --git a/.personalize.toml b/.personalize.toml index 6454a9e..229cf51 100644 --- a/.personalize.toml +++ b/.personalize.toml @@ -3,18 +3,26 @@ Name = "" # Supports markdown About = "" -# Add only the handle -Github = "" -Twitter = "" - -# Add the absolute links -Goodreads = "" -Linkedin = "" - Email = "" # Add the filename with file extension. Resume = "" # Sets the number of posts to display on the front page -PostLimit = 4 \ No newline at end of file +PostLimit = 4 + +[[profiles]] +name = "GitHub" +url = "" + +[[profiles]] +name = "Twitter" +url = "" + +[[profiles]] +name = "Goodreads" +url = "" + +[[profiles]] +name = "LinkedIn" +url = "" diff --git a/layouts/index.html b/layouts/index.html index d74095d..a69f10b 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -9,31 +9,9 @@

{{ .Site.Data.personalize.About| markdownify }}

- - {{ if ne .Site.Data.personalize.Github "" }} - - - {{ end }} - - - {{ if ne .Site.Data.personalize.Twitter "" }} - - - {{ end }} - - - {{ if ne .Site.Data.personalize.Goodreads "" }} - - - {{ end }} - - - {{ if ne .Site.Data.personalize.Linkedin "" }} - - - {{ end }} - + {{ range .Site.Data.personalize.profiles }} + {{ partial "profile_link.html" . }} + {{ end }} {{ if ne .Site.Data.personalize.Resume "" }} @@ -68,4 +46,4 @@ - \ No newline at end of file + diff --git a/layouts/partials/profile_link.html b/layouts/partials/profile_link.html new file mode 100644 index 0000000..f737edc --- /dev/null +++ b/layouts/partials/profile_link.html @@ -0,0 +1,6 @@ +{{ if and (isset . "url") ( ne .url "") }} + + + + +{{ end }}
 GitHub
 Twitter -
 Goodreads
 LinkedIn
 {{ .name }}