Use a partial to render social profile links.

The .personalize.toml now requires all social profile links be TOML table entries.
This commit is contained in:
David Gunter 2020-04-18 18:00:18 -07:00
parent bed319db4b
commit 44be73a11c
3 changed files with 27 additions and 35 deletions

View File

@ -3,18 +3,26 @@ Name = ""
# Supports markdown # Supports markdown
About = "" About = ""
# Add only the handle
Github = ""
Twitter = ""
# Add the absolute links
Goodreads = ""
Linkedin = ""
Email = "" Email = ""
# Add the filename with file extension. # Add the filename with file extension.
Resume = "" Resume = ""
# Sets the number of posts to display on the front page # Sets the number of posts to display on the front page
PostLimit = 4 PostLimit = 4
[[profiles]]
name = "GitHub"
url = ""
[[profiles]]
name = "Twitter"
url = ""
[[profiles]]
name = "Goodreads"
url = ""
[[profiles]]
name = "LinkedIn"
url = ""

View File

@ -9,31 +9,9 @@
<h4>{{ .Site.Data.personalize.About| markdownify }}</h4> <h4>{{ .Site.Data.personalize.About| markdownify }}</h4>
<table> <table>
<tr> {{ range .Site.Data.personalize.profiles }}
{{ if ne .Site.Data.personalize.Github "" }} {{ partial "profile_link.html" . }}
<td><i class="fab fa-github" aria-hidden="true"></i></td> {{ end }}
<td>&nbsp;<a href="https://github.com/{{ .Site.Data.personalize.Github }}" target="_blank">GitHub</a></td>
{{ end }}
</tr>
<tr>
{{ if ne .Site.Data.personalize.Twitter "" }}
<td><i class="fab fa-twitter" aria-hidden="true"></i></td>
<td>&nbsp;<a href="https://twitter.com/{{ .Site.Data.personalize.Twitter }}" target="_blank">Twitter</a>
</td>
{{ end }}
</tr>
<tr>
{{ if ne .Site.Data.personalize.Goodreads "" }}
<td><i class="fab fa-goodreads" aria-hidden="true"></i></td>
<td>&nbsp;<a href="{{ .Site.Data.personalize.Goodreads }}" target="_blank">Goodreads</a></td>
{{ end }}
</tr>
<tr>
{{ if ne .Site.Data.personalize.Linkedin "" }}
<td><i class="fab fa-linkedin" aria-hidden="true"></i></td>
<td>&nbsp;<a href="{{ .Site.Data.personalize.Linkedin }}" target="_blank">LinkedIn</a></td>
{{ end }}
</tr>
<tr> <tr>
{{ if ne .Site.Data.personalize.Resume "" }} {{ if ne .Site.Data.personalize.Resume "" }}
<td><i class="fas fa-file-alt" aria-hidden="true"></i></td> <td><i class="fas fa-file-alt" aria-hidden="true"></i></td>
@ -68,4 +46,4 @@
</body> </body>
</html> </html>

View File

@ -0,0 +1,6 @@
{{ if and (isset . "url") ( ne .url "") }}
<tr>
<td><i class="fab fa-{{ lower .name }}" aria-hidden="true"></i></td>
<td>&nbsp;<a href="{{ url }}" target="_blank">{{ .name }}</a></td>
</tr>
{{ end }}