Is it possible to use any other variables in 'embed.imported_from'?

Is it possible to use any other variables in embed.imported_from apart from %{link}?

I’d like to create a link using title and URL separately (in the default message the URL is displayed in full as a URL).

Thanks.

When I delete topics created via RSS they always seem to rise from the dead fairly quickly. What should I do to prevent this? Thanks.

I’m going to reduce Customise/Embedding “Maximum number of posts to embed” still further in the hope that this helps.

Edit: I reduced that to 3 and deleted eight posts. All eight were simultaneously resurrected.

Maybe the answer is just not to delete a topic until it ceases to be available in the RSS feed.

==============================

31 Oct 2020: Can’t reply as I’m talking to myself here so editing the post :slight_smile:

I now don’t think this is relevant to the RSS plugin.

I’d still like an answer to this :slight_smile:

The answer was to unlist the topics so that they wouldn’t be hoovered up from the RSS feed again.

1 Like

The path that is used is set by the value of the link attribute that is set for each feed item. I think I found the paths for the feed at rss.cnn.com by adding http://rss.cnn.com/ to my site’s Feed URL setting and then looking at the embed URLs of the topics that were created by it.

1 Like

I’m still interested in customising this message. Thanks in advance for any assistance.

Browsing through the forum today I wondered again about this. The reason I ask is that some URLs are long and messy and it would good to “hide” them behind some more useful text in an HTML a tag.

I’m still interested to hear about this :slight_smile: Thanks.

No, the value that is supplied to the %{link} placeholder is a URL that’s passed to the placeholder in the Discourse code. Changing the name of the placeholder will not have an effect on that.

Thanks. Could it be converted into a link along the lines of DuckDuckGo instead of https://duck.com/?

This won’t work with the current code. The method that’s creating the link is:

  def self.imported_from_html(url)
    "\n<hr>\n<small>#{I18n.t('embed.imported_from', link: "<a href='#{url}'>#{url}</a>")}</small>\n"
  end

That will always create a link with the link’s URL set as the link text.

Thanks again. Is that the sort of thing that can be easily overridden by a plugin? I’d like to change the whole string! I’ve never written a plugin but maybe in the long term…

Also, the topic date seems to be import date rather than RSS feed item date. Is there any way to change this? It’s not a problem until a change is made to an RSS item (eg description) at source, at which point it becomes the latest post, out of order.

Edit: the answer to this was to change the category’s default sort order to created descending! It hasn’t changed on the main Categories page but I assume it will catch up within 24 hours or so.

It’s been a while since I wrote a plugin. I believe that it would be possible to re-open the method in a plugin and customize it’s HTML output.

That is correct. The feed item date is not used when creating the topic.

2 Likes