tag:help-archives.hannonhill.com,2010-02-09:/discussions/how-do-i/20905-reference-a-folderCascade CMS: Discussion 2016-01-12T16:11:03Ztag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-08T19:52:19Z2016-01-08T19:52:19ZReference a folder<div><p>Hi Matthew,</p>
<p>A redirect is definitely what you will want. As you mentioned,
you can do it at the server level, or you can upload a very basic
HTML file that has a <a href="https://en.wikipedia.org/wiki/Meta_refresh">meta refresh</a> tag
in the <code><head></code> that points to the new
location.</p>
<p>If you go the route of the HTML file, you should also be able to
turn on the <strong>Rewrite links in file</strong> option (under
System) and use the
<code>[system-asset]/path/to/path[/system-asset]</code> syntax to
generate a link dynamically. Note: it is not possible to link to a
folder, so it needs to be a link to a page or file.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-08T20:15:20Z2016-01-08T20:15:20ZReference a folder<div><p>Hey Ryan,</p>
<p>I think this might be a good solution to this problem. I'm
testing all this out in our Dev instance of our site and I'm having
some issues that I'm hoping you can spot.</p>
<p>I created a very simple HTML file that contains the meta refresh
tag in it but I think my <code>[system-asset]</code> is screwed
up.</p>
<p>here's the file</p>
<pre>
<code><meta http-equiv="refresh" content="0; url=[system-asset]/equity-diversity/index[/system-asset]"></code>
</pre>
<p>it ends up displaying this in the URL<br>
<code>http://wwwdev.scranton.edu/academics/provost/equity-diversity/[system-asset]/equity-diversity/index[/system-asset]</code></p></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-08T20:55:45Z2016-01-08T20:55:45ZReference a folder<div><p>sorry this is the HTML file (it's not much different
honestly)</p>
<pre>
<code><html>
<head>
<meta http-equiv="refresh" content="0; url=[system-asset]/equity-diversity/index[/system-asset]">
</head>
<body>
</body>
</html></code>
</pre></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T13:09:48Z2016-01-11T13:09:48ZReference a folder<div><p>Hi Matthew,</p>
<p>The snippet you provided looks correct to me. When you have a
moment, please confirm you have the <strong>Rewrite links in
file</strong> option turned on within the HTML file's System pane
and that a page at the path <code>/equity-diversity/index</code>
indeed exists.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T14:05:36Z2016-01-11T14:05:36ZReference a folder<div><p>Here's the page's system settings</p></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T18:13:26Z2016-01-11T18:13:26ZReference a folder<div><p>Hi Matthew,</p>
<p>My apologies for the confusion. What we're looking for here
would be the <strong>Rewrite links in file</strong> option when
editing your new, simple HTML file, not the page you are linking
to.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T18:51:02Z2016-01-11T18:51:02ZReference a folder<div><p>That did the trick!</p>
<p>I'm trying to create a page with a data definition that uses a
page chooser to select the page's path. I created a super simple
Template with a region in place of the meta field. I placed the
meta field into a velocity script and I'm trying to pull the page's
path but I continue to get an error. I think something is wrong my
variable initialization or maybe this isn't the way I should do it
but can you nudge me in the right direction?</p>
<pre>
<code>#set($redirect = $_XPathTool.selectSingleNode($contentRoot, '//system-index-block/calling-page/system-page/system-data-structure/internal/path").value)
<meta http-equiv="refresh" content="0; url=[system-asset]$redirect[/system-asset] "/></code>
</pre>
<pre>
<code><?xml version="1.0" encoding="UTF-8"?>
<system-index-block name="current page" type="folder" current-time="1452538239512">
<calling-page>
<system-page id="31f24a5286c604b375e59258ae20d74b" current="true">
<name>index</name>
<path>/academics/provost/equity-diversity/index</path>
<site>www.scranton.edu</site>
<link>site://www.scranton.edu/academics/provost/equity-diversity/index</link>
<system-data-structure definition-path="Re Directs/redirect">
<location>Internal</location>
<internal type="page">
<content />
<path>/equity-diversity/index</path>
<dynamic-metadata>
<name>seo-title</name>
</dynamic-metadata>
<dynamic-metadata>
<name>nav</name>
<value>No</value>
</dynamic-metadata>
<dynamic-metadata>
<name>DepartmentProgram</name>
<value>-- choose --</value>
</dynamic-metadata>
<link>site://www.scranton.edu/equity-diversity/index</link>
<site>www.scranton.edu</site>
<name>index</name>
<display-name>Mission</display-name>
<title>Office of Equity and Diversity: The University of Scranton</title>
<keywords>northeast, Pennsylvania, diversity, veteran, African, Latin, Hispanic, disability, diverse</keywords>
</internal>
<external />
</system-data-structure>
</system-page>
</calling-page>
</system-index-block></code>
</pre></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T19:35:00Z2016-01-11T19:35:00ZReference a folder<div><p>I came up with something that works but is this reliable? Is
there a better way to do it this way?</p>
<pre>
<code>
#set($redirect = $_XPathTool.selectSingleNode($contentRoot, "//system-index-block/calling-page/system-page/system-data-structure/internal/path").value)
#set($ext = ".shtml")
<meta http-equiv="refresh" content="0; url=$redirect$ext"/></code>
</pre></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T20:14:56Z2016-01-11T20:14:56ZReference a folder<div><p>Hi Matthew,</p>
<blockquote>
<p>but I continue to get an error. I think something is wrong my
variable initialization or maybe this isn't the way I should do it
but can you nudge me in the right direction?</p>
</blockquote>
<p>Off-hand, the Velocity looks OK. What is the error you are
seeing?</p>
<blockquote>
<p>I came up with something that works but is this reliable? Is
there a better way to do it this way?</p>
</blockquote>
<p>If you use the <code>[system-asset]</code> pseudo tag, Cascade
will add the extension for you on publish, so you shouldn't have to
worry about doing this.</p>
<p>Also wanted to add you can implement the same Velocity Format
using the <code>$currentPage</code> variable and Cascade API, thus
eliminating the need to use an Index Block all-together. Something
like the following should do the trick:</p>
<pre>
<code>#set ($redirectPath = $currentPage.getStructuredDataNode("internal")))
#if (!$_PropertyTool.isNull($redirectPage.asset))
<meta http-equip="refresh" content="0; url=[system-asset]${redirectPath.asset.link}[/system-asset]"/>
#end</code>
</pre>
<p>Also note that I used <code>link</code> instead of
<code>path</code> to properly handle cross-Site links.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T20:27:33Z2016-01-11T20:27:33ZReference a folder<div><p>Hey Ryan,</p>
<p>I'm not sure now since I changed the code. It was syntax or
lexiconically error? Something strange.</p>
<p>I knew there was something the remove the need for an index
block but I couldn't remember, thanks!</p>
<p>This current code doesn't seem to redirect the page, am I
missing anything? I took what you wrote and used it as the
format.</p></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T20:55:39Z2016-01-11T20:55:39ZReference a folder<div><p>My fault, Matthew, my Format had a minor bug in it. When you
have a moment, try changing:</p>
<pre>
<code>$redirectPage.asset</code>
</pre>
<p>To:</p>
<pre>
<code>$redirectPath.asset</code>
</pre>
<p>Let me know if this helps at all.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T21:00:19Z2016-01-11T21:00:19ZReference a folder<div><p>hey Ryan,</p>
<p>I change it and it still appears to just display a blank page
and doesn't redirect the link.</p>
<p>I viewed the source of the blank page and it looks like it's
grabbing the link's path but it's not doing anything with it</p>
<pre>
<code><html>
<head>
<meta content="0; url=../../../equity-diversity/links.shtml" http-equip="refresh"/>
</head>
<body>
</body>
</html></code>
</pre></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T21:12:39Z2016-01-11T21:12:39ZReference a folder<div><p>Hi Matthew,</p>
<p>Are you able to provide a URL to the file with the refresh
<code><meta></code> tag?</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T21:17:39Z2016-01-11T21:17:39ZReference a folder<div><p>Currently no because this is all being done on our Test instance
of Cascade and anything we publish is only viewable on campus.</p></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-11T21:29:23Z2016-01-11T21:29:23ZReference a folder<div><p>I recreated everything in our prod instance but using different
pages</p>
<p><a href="http://www.scranton.edu/_internal/Redirect/base-asset.shtml">http://www.scranton.edu/_internal/Redirect/base-asset.shtml</a></p></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-12T14:01:16Z2016-01-12T14:01:16ZReference a folder<div><p>Hi Matthew,</p>
<p>My mistake for providing you with incorrect information in my
initial code snippet. The <code>http-equip="refresh"</code>
attribute should be <code>http-equiv="refresh"</code>. Try this
adjustment and let me know how it works out.</p>
<p>Also, I wanted to note you should not need the <strong>Maintain
absolute links</strong> option checked on your redirect page.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-12T14:45:19Z2016-01-12T14:45:19ZReference a folder<div><p>that's its! Thanks so much for all your help with this!</p>
<p>Can you help me understand this new code snippet? I want to
document how to create these redirects now and I want to better
understand the tools used to create the format. can you tell me
line by line how this works? Most of it looks new to me.</p>
<pre>
<code>#set ($redirectPath = $currentPage.getStructuredDataNode("internal"))
#if (!$_PropertyTool.isNull($redirectPath.asset))
<meta http-equiv="refresh" content="0; url=[system-asset]${redirectPath.asset.link}[/system-asset]"/>
#end</code>
</pre></div>matthew.wrentag:help-archives.hannonhill.com,2010-02-09:Comment/388746872016-01-12T16:11:02Z2016-01-12T16:11:02ZReference a folder<div><p>Thank you for following up, Matthew. I am glad to hear the
adjustment did the trick.</p>
<pre>
<code>#set ($redirectPath = $currentPage.getStructuredDataNode("internal"))</code>
</pre>
<p>This line uses a sort of global <code>$currentPage</code>
variable that we provide to Velocity Formats. The contents of this
variable is the calling page's Cascade API <code>Page</code>
object. The <code>getStructuredDataNode</code> method is one of
many methods available to the object and it takes in a string
parameter which is essentially a path (ie group identifier(s) and
the field's identifier) to a field you wish to obtain. Again, we're
using the Cascade API, so this will return a
<code>StructuredDataNode</code> object.</p>
<p>For more details on the objects, you can use
<code>$_PropertyTool.outputProperties($currentPage)</code> and
<code>$_PropertyTool.outputProperties($redirectPath)</code>.</p>
<pre>
<code>#if (!$_PropertyTool.isNull($redirectPath.asset))</code>
</pre>
<p>This line is simply checking to see if the asset chooser has an
asset selected, which will be a Cascade API object, such as a
<code>Page</code>, <code>File</code>, etc..</p>
<pre>
<code><meta http-equiv="refresh" content="0; url=[system-asset]${redirectPath.asset.link}[/system-asset]"/></code>
</pre>
<p>The important part of this line would be
<code>$redirectPath.asset.link</code>, which is outputting the
<code>link</code> property of the chosen asset. Again, this is a
Cascade API object so you're outputting properties.</p>
<p>For more details on the chosen asset, you can use
<code>$_PropertyTool.outputProperties($redirectPath.asset)</code>.</p>
<p>I'm going to go ahead and close this discussion, please feel
free to comment or reply to re-open if you have any additional
questions.</p>
<p>Have a great day!</p></div>Ryan Griffith