AMP for XenForo

AMP for XenForo [Paid] 1.0.10

No permission to buy ($35.00)

NixFifty

XenForo developer
Staff member
Good to hear as I got a mail saying that my license is about to expire. Dont' want to buy XF1 license again :)
You don't have to but a license again, just extend your current one.
ozzy is correct- You'll just need to extend your existing one and then when the XF2 version drops, you'll have access to the XF1 and XF2 versions. You're welcome to hold off renewal until release though.
 

dutchbb

Well-known member
DiscussionForumPosting can also be used in AMP structured data. This would be a better choice instead of NewsArticle and should increase the chance to be placed in carousel. I adjusted this in the helper file, markup is the same i think (no error).

https://developers.google.com/search/docs/guides/about-amp

Also when using the media pack add-on video (and other) embeds do not work. Looks like only youtube embeds are converted?

https://xenforo.com/community/resources/s9e-media-bbcodes-pack.2476/

AMP page
Code:
<span data-s9e-mediaembed="youtube"><span></span></span>

Normal
Code:
<span data-s9e-mediaembed="youtube" style="display:inline-block;width:100%;max-width:640px"><span style="display:block;overflow:hidden;position:relative;padding-bottom:56.25%"><iframe allowfullscreen="" scrolling="no" style="background:url(https://i.ytimg.com/vi/EAGLTTedwSs/hqdefault.jpg) 50% 50% / cover;border:0;height:100%;left:0;position:absolute;width:100%" src="https://www.youtube.com/embed/EAGLTTedwSs"></iframe></span></span>
 
Last edited:

dutchbb

Well-known member
2 more errors, not sure if this is specific to my forum. Other then few error pages are indexing good.
Code:
The parent tag of 'amp-analytics extension .js script' is 'div', but can only be 'head'.

The parent tag of 'style amp-custom' tag is 'div', but can only be 'head'
 

NixFifty

XenForo developer
Staff member
2 more errors, not sure if this is specific to my forum. Other then few error pages are indexing good.
Code:
The parent tag of 'amp-analytics extension .js script' is 'div', but can only be 'head'.

The parent tag of 'style amp-custom' tag is 'div', but can only be 'head'
Could you start a convo with me with the URLs that trigger these errors and also the ones that don't work with the media embed add-on? We'll get that fixed up in no time. :)
 

NixFifty

XenForo developer
Staff member
It's being worked on. There are still a few validation errors that need to be addressed. Hopefully not too far off a release now though.
 

neil1

Member
I am very much interested in this addon for XF2, will this work with the current default style?
 

dutchbb

Well-known member
DiscussionForumPosting can also be used in AMP structured data. This would be a better choice instead of NewsArticle and should increase the chance to be placed in carousel. I adjusted this in the helper file, markup is the same i think (no error).

https://developers.google.com/search/docs/guides/about-amp

Edit: Strangly enough only with Article, BlogPosting and NewsArticle an example link is shown in google structured data test. So not sure DiscussionForumPosting is gone work at the moment, but with AMP test it does show correct. I have chosen Article for the moment to be sure, NewsArticle is somewhat misleading and google could not like it.

Regarding this, google suggests putting it on the canonical page also (at bottom 'thread_view' template). This is especially important on xf2 if you add it as DiscussionForumPosting because google will only use the canonical structured data version if present.

I added interactionStatistic like on xf2, it shows amount of messages on search next to date, and articleSection. 'description' is set to 200 (max. for structured data) and should show the first post of the thread instead of page (will add when found). 'image' width and height (avatar m) i have to find the code first but not required by google.

Same for 'logo', i added the width and height manual is this case because image stays the same and dimensions should be 60x600 or less. More info (bottom of page): https://developers.google.com/search/docs/data-types/article#amp

DatePublished and modified UTC changed manually (set to correct timezone +.. : .. )
https://en.wikipedia.org/wiki/UTC

Code:
<script type="application/ld+json">
{
  "@context":"http://schema.org",
  "@type":"DiscussionForumPosting",
  "mainEntityOfPage": "{xen:link 'canonical:threads', $thread, 'page={$page}'}",
  "headline":"{xen:jsescape $thread.title}",
  "description":"{xen:jsescape '{xen:helper snippet, $firstPost.message, 200}'}",
  "image": {
    "@type":"ImageObject",
    "url":"{xen:jsescape '{xen:helper avatar, $thread, m, 0, 1}'}"
  },
  "articleSection": "{xen:jsescape $forum.title}",
  "datePublished":"{xen:jsescape '{xen:date $thread.post_date, 'Y-m-dTh:m:s+00:00'}'}",
  "dateModified":"{xen:jsescape '{xen:date $thread.last_post_date, 'Y-m-dTh:m:s+00:00'}'}",
  "author": {
    "@type":"Person",
    "name":"{xen:jsescape $thread.username}"
  },
  "publisher":{
    "@type":"Organization",
    "name":"{$xenOptions.boardTitle}",
    "logo": {
      "@type":"ImageObject",
      "url":"https://(your logo location full path)",
      "width":190,
      "height":60
  }
},
  "interactionStatistic": {
    "@type":"InteractionCounter",
    "interactionType":"https://schema.org/ReplyAction",
    "userInteractionCount": "{xen:calc "{$totalPosts} - 1"}"
  }
}}
</script>
 
Last edited:

dutchbb

Well-known member
It is also converting email adresses and telephone numbers on AMP pages to internal links.

Code:
<a href="https://....com/mailto:something.k@hotmail.com">something.k@hotmail.com</a>

https://.....com/tel:+37105090998
 
Top