Mentions of people, places and Avatars in One-box issues


(Republic Wireless) #1

When the body of a comment linked to a Wordpress post has a @mention, #place, or image. The resulting links are relative and that breaks links in the comment. This causes crawlers to choke and other issues. Is there a way to fix this?

Example:

<div class="comment-content"><p>Hi <a class="mention" href="/u/jonathan1">@jonathan1</a>,</p>
<p>We announced we will be supporting the Pixel 2 and Pixel 2 XL, earlier today.</p>
<aside class="quote">
  <div class="title">
    <div class="quote-controls"></div>
    <img alt="" width="20" height="20" src="/user_avatar/forums.republicwireless.com/beng/40/8320_1.png" class="avatar">
    <a href="https://forums.republicwireless.com/t/google-pixel-2-and-pixel-2-xl-byop-support/13162?source_topic_id=11985" rel="nofollow noopener">Google Pixel 2 and Pixel 2 XL BYOP Support</a> <a class="badge-wrapper  bullet" href="/c/news"><span class="badge-category-bg" style="background-color: #e44e13"></span><span class="badge-category clear-badge" title="Keep up with official Republic Wireless news, releases, and important announcements.">Announcements &amp; News</span></a>
  </div>
  <blockquote>
    We’re excited to announce that we’ll be supporting the <a href="https://store.google.com/product/pixel_2" rel="nofollow noopener">Google Pixel 2 and Pixel 2 XL</a> through our <a href="https://help.republicwireless.com/hc/en-us/articles/115005739967" rel="nofollow noopener">BYOP program</a>!
  </blockquote>
</aside>
</div>

I think the integration is fixing the @mention but the other two are broken and the source is wrong for all of them causing crawlers to break.

58 PM

<p>Read our announcements <a class="hashtag" href="/c/7-news">#<span>news</span></a></p>

Let me know if more detail is needed.


(Simon Cossar) #2

I’m looking at it now. I’ll get back to you soon.


(Simon Cossar) #3

Relative URLs in images and mentions are supposed to be converted to absolute URLs by the plugin, but there are issues with the way it’s doing it. Mention URLs are being converted to absolute URLs with javascript - this isn’t going to work for crawlers, Image URLs are being converted to absolute URLs with a regular expression! There are cases where the regular expression will fail.

Hashtag URLs are not dealt with at all.

I think the whole problem of relative URLs can be approached in a different way. I’ll try to do something with it today. Thanks for bringing this up.


(Simon Cossar) #4

It works, no more regular expressions! The fix depends on the php-xml extension being loaded on the server. Generally it is, but if not, the plugin will fall back to it’s old method. I’ll let you know when it gets pushed to the WordPress repo. It will be sometime tomorrow.


(Republic Wireless) #5

Thank you so much! :grinning: