Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mattstratton/castanet.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/social-link.html')
-rw-r--r--layouts/partials/social-link.html16
1 files changed, 16 insertions, 0 deletions
diff --git a/layouts/partials/social-link.html b/layouts/partials/social-link.html
new file mode 100644
index 0000000..f969774
--- /dev/null
+++ b/layouts/partials/social-link.html
@@ -0,0 +1,16 @@
+<!--
+Original config had people giving short forms like "mattstratton" which were converted
+to full URLs like https://www.linkedin.com/in/mattstratton but later support was
+added to allow the user to pass in full URLs to support other use cases like
+linking to a company page e.g. https://www.linkedin.com/company/linkedin/
+
+This utility partial will parse the url to look for a schme like http or https.
+If a scheme exists then we will just include the full URL as it is, otherwise
+we will take the prefix passed in and concatenate them together for backwards
+compatability
+-->
+{{ if gt (len (urls.Parse .context).Scheme) 0 }}
+ <a class="{{ .aclass }}" href = "{{ .context }}"><i class="{{ .iclass }}"></i>{{ .text }}</a>
+{{ else }}
+ <a class="{{ .aclass }}" href = "{{ .prefix }}{{ .context }}"><i class="{{ .iclass }}"></i>{{ .text }}</a>
+{{ end }}