[VIVO-1237] Add ability to generate meta tags

This commit is contained in:
Graham Triggs 2016-07-05 17:52:03 +01:00
parent f61d3b1a1a
commit 61f90dd1e6
4 changed files with 12 additions and 1 deletions

View file

@ -464,6 +464,7 @@ public class FreemarkerHttpServlet extends VitroHttpServlet {
map.put("stylesheets", new Tags().wrap()); map.put("stylesheets", new Tags().wrap());
map.put("scripts", new Tags().wrap()); map.put("scripts", new Tags().wrap());
map.put("headScripts", new Tags().wrap()); map.put("headScripts", new Tags().wrap());
map.put("metaTags", new Tags().wrap());
return map; return map;
} }

View file

@ -12,6 +12,7 @@ import java.util.Map;
import javax.servlet.ServletContext; import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.Tags;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -46,6 +47,7 @@ public abstract class Widget {
map.put("stylesheets", dataModel.get("stylesheets")); map.put("stylesheets", dataModel.get("stylesheets"));
map.put("scripts", dataModel.get("scripts")); map.put("scripts", dataModel.get("scripts"));
map.put("headScripts", dataModel.get("headScripts")); map.put("headScripts", dataModel.get("headScripts"));
map.put("metaTags", new Tags().wrap());
map.put("urls", dataModel.get("urls")); map.put("urls", dataModel.get("urls"));
} catch (TemplateModelException e) { } catch (TemplateModelException e) {
log.error("Error getting asset values from data model."); log.error("Error getting asset values from data model.");

View file

@ -10,6 +10,10 @@
<#include "headScripts.ftl"> <#include "headScripts.ftl">
<#if metaTags??>
${metaTags.list()}
</#if>
<#-- Inject head content specified in the controller. Currently this is used only to generate an rdf link on <#-- Inject head content specified in the controller. Currently this is used only to generate an rdf link on
an individual profile page. --> an individual profile page. -->
${headContent!} ${headContent!}

View file

@ -15,6 +15,10 @@
<script type="text/javascript" src="${urls.base}/js/selectivizr.js"></script> <script type="text/javascript" src="${urls.base}/js/selectivizr.js"></script>
<![endif]--> <![endif]-->
<#if metaTags??>
${metaTags.list()}
</#if>
<#-- Inject head content specified in the controller. Currently this is used only to generate an rdf link on <#-- Inject head content specified in the controller. Currently this is used only to generate an rdf link on
an individual profile page. --> an individual profile page. -->
${headContent!} ${headContent!}