Not sure if this is possible. I want it so that when a user goes to a specific page (e.g. www.mywebsite.com/next-webinar) that they are redirected to the node of what is actuall the next webinar.

So I have a view created and I have the webinar content type, as well as the date and time, and a Content: Link field. I'm displaying only 1 node at a time and sorting by date and time (ascending).

Is there any way to use either a page view (with the page www.mywebsite.com/next-webinar) or a block on that url so that when the page is loaded the user is redirected to the node link (Content: Link field) for the next webinar?

Comments

moniuch’s picture

Version: 7.x-3.3 » 7.x-3.5
Category: support » feature

I second that request. I'd say it'd be the equivalent of "Default Menu Tab" yet beyond tabs, yet with a drupal_goto redirect.
This is especially needed when having a View for which you do not need to prepare a dedicated "landing page" or "index page". The above scenario is a good example, although mine was a bit different - dealing with a News content type:

1. You want to have a view that collects news (sorted by post date, desc) accessible at example.com/news and forms it as a navigation menu block.
2. By defining block's visibility URLs, you want to make your block visible only when viewing News nodes to make that section navigable.
3. You want to have a menu item "Latest News" in a menu, linked to /latest-news.
4. Upon selecting the menu item, you want to redirect user and show them the latest news node.

Therefore I'd say this request makes a perfect sense for any time-sensitive content and would facilitate dynamic linkage. You'd just need a UI to establish the redirect from the views page URL (latest-news) to the item that you'd specify in the Views UI (typically first listed, but other options could make sense as well). And this is the hardest thing to achieve without digging into writing module.

Moving to v3.5 BTW and marking as feature request, as this is not doable with current Views UI.

moniuch’s picture

Let me just ask one year after posting that issue if it has at least been reviewed, evaluate and whether is being considered.

dhigby’s picture

I'm also looking for this functionality, to forward to the URL for the most recent newsletter when going to example.com/newsletter.

The most recent newsletter does currently display with that URL, but because it also exists at the node specific URL, I will be penalized by SEO. I also don't have access to node specific options such as a facebook "Like" button.

I've asked for help on this issue at drupal.stackexchange here.

hixster’s picture

Why wouldn't you just show 1 single news item in the view and always the latest one - there wouldn't be any need to redirect? Essentially this what your aski g this view to do no?

moniuch’s picture

@hixster The example of the original poster is perhaps unfortunate because he refers to 'next-webinar' which lexically means only 1 single item. And so you are right about your suggestion. But imagine a situation where the path says "upcoming-webinars". And you want the view to automatically redirect user to the first item while not limiting your viewing just to that one and without altering the URL of the first viewed item.

The problem is that this first item is dynamic - it changes in time. You can organize a webinar ad hoc and insert it as the first one, you can delete some. If you had to use redirects you would have to redefine it every time a webinars are messed with. Not an option. Yet Views knows exactly which node will be placed as that "first one", so why wouldn't it trigger an appropriate drupal_goto once the view has been rendered?

This is exactly how I understood the need and that's exactly the need I happened to have. I ended up writing a module messing with URLs but I think the module should not be needed for such trivia. A workaround is always a nice thing to find, but I believe we are asking for a simple feature :)

hixster’s picture

Should be reasonably simple to achieve with a small php snippet or as you say a small module.

Views_get_view_results() limited to 1 result.
Get the Node Id or path and redirect to it.

views get views results / API reference