Possible to change hyperlink address between actual content page and RSS feed of that page?

Is it possible, through a shortcode or some other parameter setting, to have a link point to one address in the actual built content html page, and in the rss feed version of the content that link is a different address?

Example: In content the link points to an amazon product through your affiliate account. But the published rss of your website which includes the full content of your page, doesn’t have the amazon link but instead it is replaced with a link pointing to the content’s actual web address, which does have the amazon link.

(background: amazon doesn’t allow affiliate links in emails or rss feeds)

So is there any clever way to accomplish this? I’m thinking a shortcode which uses a given link address for the html and uses the content page link in the rss feed.

You can have shortcodes per output format; add myshortcode.html and myshortcode.xml and they will be used correctly.

1 Like

and in the content file I would use {{% myshortcode amazonlink %}} and it would use the appropriate shortcode type for the corresponding output?

If that’s how it works, that’s freaking awesome. Thank you!

Is this documented anywhere? In both shortcode doc pages it never indicates this to be an option, I suppose one could extrapolate since you can have templates for html and xml, etc. but this is really a fantastic feature that should be known.

Yes, that is correct.

As to documentation, I thought I added docs about this, but I might have missed that … I will try to improve in that area.

It will try to find the most specific shortcode template, falling back to default HTML … so for RSS: myshortcode.rss.xml, myshortcode.xml, myshortcode.html.

brilliant, thanks!