0

Bit of an odd request. I want to somehow change/alias the URL of a node to an external website. We are importing a calendar of events from our booking vendor to show nicely on our page. In the end, the user must go to the booking vendor website to enroll though. While I want all the imported data to be able to be shown on our website (so we can show snippets in blocks, and so forth), I want the node link to go to the event on the booking website. Our import does include the booking URL for each event.

I tried using the rules module to overwite the node:url on import, but it obviously does not allow this. I assume I could work some wizardry in views, but I would need the URL to change for blocks, calendar views, list views, etc. Is there some way to make a node always redirect to an external URL based on the import I am using "Feeds import" with an iCal feed?

To make it harder, I also lack any code level access.

This is probably a hail mary, but I figured I would ask. Thanks!

1 Answer 1

0

Ok so since you already have a url field:

  • Set up a new rule where the event is Content is viewed of type YourContentType.
  • Add a Page redirect action.
  • For the destination use your field as a replacement pattern. So something like: node:field-url.

Just take note that you won't be able to view your content with this rule. But you can still access the edit page using the content management interface.


Just for your information, if you DO get access to the code:

You can use hook_node_view to create redirects. Since you already have the event URL in the node data you can use a drupal_goto.

Here's a snippet I found in a related question. I changed some things though.:

module_node_view($node, $view_mode, $langcode) {
  if ($view_mode == 'full' && "Conditions") {
    // Change $node->url to what works.
    // Use the devel module and krumo() to check the contents of $node.
    drupal_goto($node->url);
  }
}

I've assumed you're using Drupal 7.

4
  • Thanks for the info. As I mentioned in the end of my first post though, I lack any access to coding. I was hoping the rules module, or something of that nature might help.
    – Comprox
    Mar 29, 2017 at 2:48
  • Missed reading that part, sorry. Let me get back to you. Mar 29, 2017 at 3:01
  • Ok Comprox, updated! Mar 29, 2017 at 3:15
  • Thanks, that worked perfectly! I feel silly for missing the page redirect in rules now.
    – Comprox
    Mar 29, 2017 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.