Hi all,
I'm wondering if it is possible to create a resource that, when accessed, runs a snippet in order to decide where to direct the user to. So, essentially, a weblink, but with the ability to have its content parsed.
The site I am working on is a portfolio, where my client has a number of projects displayed. Each project is a resource. The client would like the "Gallery" link in the primary navigation to take the user to the most recently added project.
I had thought the solution was to create a weblink and stick a snippet call into the content, but of course, weblink content isn't actually parsed, so that won't work. Next I tried to do the same with a static resource since,
according to the page in the manual, "you can specify custom paths to set as System Settings, or use Snippets to dynamically find the path," which is
exactly what I want to do. But that doesn't appear to be working either. I get a blank, white page. Here is the snippet call I am using:
[[getResources? &limit=`1` &parents=`3` &hideContainers=`1` &sortby=`publishedon` &sortdir=`DESC` &tpl=`Gallery Link Output`]]
I've tried having the template return the ID, a link to the ID and the alias of the project resource. No dice.
I would consider merely calling the above snippet in the navigation, but I'd like to be able to use Wayfinder and the content of this page might eventually change (the client may decide to have a landing gallery page with unique content on it). I would consider writing a custom snippet that programmatically redirects, but I feel like there is a better, simpler way to do this. Can I add a content disposition that contains a 302 redirect, perhaps?
What am I doing wrong? Am I going about this the wrong way? Is there a better way?
Thanks in advance.