Let's say we have a section
/latest-projects with a menu block listing nodes sorted descending by their post date. Thus, the first item will often change and be the freshest one. Is it possible to make the
/latest-projects alias always link to (= open) the top-most node?
Indeed it is.
Steps you will need to do:
- Create a custom module
- Implement hook_menu()
- Define the route 'latest-projects', and make the menu callback a function
- In the custom menu callback function do SQL or whatever to find the latest project (maybe use EnityFieldQuery in Drupal 7)
- Use drupal_goto() to then redirect the user to the latest project node
Note in the above solution, a redirect is used to send the user to the project node, but if needed you can also simply render the node on the page as another idea.