-
Notifications
You must be signed in to change notification settings - Fork 3
2 footer links format
Rob Knight edited this page Feb 20, 2018
·
2 revisions
Create the footer format in _Library/global/formats and add this code:
#set($socials = $_XPathTool.selectNodes($contentRoot, "social-link"))
#set($customs = $_XPathTool.selectNodes($contentRoot, "custom-link"))
## Set classes for Font Awesome icons based on social site
#set($icons = {
"Facebook":"fab fa-facebook-f",
"Flickr":"fab fa-flickr",
"Instagram":"fab fa-instagram",
"LinkedIn":"fab fa-linkedin-in",
"Snapchat":"fab fa-snapchat-ghost",
"Soundcloud":"fab fa-soundcloud",
"Tumblr":"fab fa-tumblr",
"Twitter":"fab fa-twitter",
"Vimeo":"fab fa-vimeo-v",
"YouTube":"fab fa-youtube"
})
## $_PropertyTool.outputProperties($icons)
## Only output the social links div if there are links
#if ($socials.size() > 0)
<div class="social-media">
#foreach ($item in $socials)
#set($url = $item.getChild("url").value)
#set($site = $item.getChild("site").value)
<a href="${_EscapeTool.xml($url)}"><i class="${icons[$site]}"></i></a>
#end
</div>
#end
#if ($customs.size() > 0)
<div class="links">
#foreach ($item in $customs)
#set($text = $item.getChild("text").value)
#set($site = '')
#if ($item.getChild("page").getChild("content"))
#set($site = $item.getChild("page").getChild("path").value)
#else
#set($site = $item.getChild("url").value)
#end
<a href="${site}">${_EscapeTool.xml($text)}</a>
#end
</div>
#endFinally, add <script defer="true" src="https://use.fontawesome.com/releases/v5.0.6/js/all.js"></script> to the uniform-campus-html-head block and global-html-head.html block in the _library and static sites, respectively.