Skip to content

Instantly share code, notes, and snippets.

@jlafitte
Last active December 16, 2015 02:39
Show Gist options
  • Save jlafitte/5364564 to your computer and use it in GitHub Desktop.
Save jlafitte/5364564 to your computer and use it in GitHub Desktop.
SAM href-override extended functionality. When there is a manual override specified, in SAM Admin it will show a message to the user so they know the page will not be seen. In stage and publish it will create script and fallback meta tag to redirect the page. Technically meta tags are meant to be in the head block, my testing seems to indicate i…
<xsl:variable name="href-override" select="/SAM/navigation/link[@id = /SAM/page/@id]/href-override" />
<xsl:if test="$href-override">
<xsl:choose>
<xsl:when test="@directive = 'admin'">
<p class="error" style="text-align:center">
This page is redirecting to <a href="{$href-override}" target="_blank"><xsl:value-of select="$href-override"/></a>.<br />
You may change this in Architecture &gt; Edit Page Info &gt; Edit Advanced &gt; Manual URL Override.
</p>
</xsl:when>
<xsl:otherwise>
<script>
location.href = '<xsl:value-of select="$href-override" />';
</script>
<noscript>
<meta http-equiv="refresh" content="0;URL='{$href-override}'" />
</noscript>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment