Add something like meta, rel to the head of posts

AI-generated summary

Bcat is seeking a solution to add a <link rel="amphtml" href="AMP-DOMAIN.LINK_POST"/> tag to the <head> of posts in Discourse, citing frustration over previous rejections of similar requests. They believe a plugin could resolve this, as the functionality is specific to their website. Bcat notes that creating a plugin with a connector file like topic_header/rel_amphtml.html.erb works, though changes require server restarts. They shared a plugin example at https://github.com/bcat95/discourse-tvms-amp and mentioned that Google may still recognize the tag even if it’s not in the <head>, as seen in a screenshot image.

It’s a shame, but I’ve been looking for a solution for the past 60 days. So hope you have the knowledge can help.

This is the 3rd topic on this issue, the previous times it was rejected because it doesn’t need discourse and needs to rewrite the whole etc … But I think this is customized for only one website so a plugin can solve this problem.

I have found one more code in other connectors but between and I have not found any instructions.

Back to the main issue:
Add this to the <head> on post.

<link rel = "amphtml" href = "AMP-DOMAIN.LINK_POST"/>

If it needs a lot of customization, move to post to the paid request section.

This is the previous post Add rel="amphtml" to head - any tips?
It is quite stressful every day, but the boss still asks how the work is progressing.

I agree that it is not good for discourse but I personally need to try to see how the result works!

If using javascript to create it will not display when view-source means it needs to be created first.

If I create a new plugin with app/views/connectors/topic_header/rel_amphtml.html.erb It will show up! Actually every change in the plugin takes some time to run the server again, so the server should not fail.

I have create:

It seems that Google still understands whether the tag is in the body, not the head