Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to have @ mentions in xml/json feeds #66

Open
brandontreb opened this issue Nov 26, 2018 · 1 comment
Open

Add ability to have @ mentions in xml/json feeds #66

brandontreb opened this issue Nov 26, 2018 · 1 comment

Comments

@brandontreb
Copy link

Im currently using this plugin to handle mentions for micro.blog. I noticed that it filters out everything that's not a "page". Is there a way to have the plugin convert the @ mentions on a feed.json and feed.xml page?

Thanks so much!

@fancypantalons
Copy link

fancypantalons commented Feb 8, 2020

I needed this as well, and it looks like altering this plugin as-is is harder than it looks due to the need to escape the output for XML documents, so I took a different approach. I ripped out the guts of the plugin and turned it into a liquid filter:

https://gist.github.com/fancypantalons/017ec408f92b2b25f33947f13f2507b0

Just drop this in your _plugins folder (and add the "html-pipeline" gem to your Gemfile) and this creates a new "replace_mentions" liquid filter that you can use to do something like this:

{{ content | replace_mentions | xml_escape }}

Because it's a filter, this is a lot more flexible, as you can apply it at your discretion. In my case, I apply it in the default layout as well as in the XML template that I use for generating my RSS feed (which I then pass into an xml_escape pass).

Because I basically gutted the existing plugin, this uses all the same configuration settings and so forth, so it should drop in cleanly and can even be used side-by-side with the plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants