[openstreetmap/openstreetmap-website] Improve the preview of diary entries on social media sites (using OpenGraph HTML tags) (PR #3942)
Andy Allan
notifications at github.com
Wed Mar 8 17:14:47 UTC 2023
There's a few things that come up here on further review:
* As hinted at in the comments, I think it's worth removing the markup from the description, rather than outputting it. The PR currently uses "to_text" which just returns the raw content, rather than a text-only representation. So I would prefer to see "something <b>important</b>" be outputted as "something important". We could use the `[strip_tags](https://api.rubyonrails.org/classes/ActionView/Helpers/SanitizeHelper.html#method-i-strip_tags) helper on the `to_html` output to do so
* The description is shortened by calling `[0..300]`, but we could use the rails `[truncate](https://api.rubyonrails.org/classes/ActionView/Helpers/TextHelper.html#method-i-truncate)` helper to do this more cleanly.
I think we can also look at the [meta-tags](https://github.com/kpumuk/meta-tags) gem, which doesn't cover the above points, but it could help us with setting defaults etc without having to build our own `set_meta_tags` equivalent. That could be done in a "prerequisites" pull request (i.e. another PR that introduces that gem, and then this PR refactored to use it).
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3942#issuecomment-1460524150
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/3942/c1460524150 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20230308/4c982358/attachment-0001.htm>
More information about the rails-dev
mailing list