(No) Opengraph meta data on login page

One of our customers discourse instance is configured that people have to register before they can access the content. One unwanted side-effect is when people share the URL of the website on social media the preview image shown on Facebook and Twitter is not their default opengraph image or twitter summary large image. On the login page the og:image and twitter:image html tags are not used in the HTML.

Currently there is no Opengraph meta data on the login page. Is this intentional? How would we be able to work around that?

5개의 좋아요

You’d have to edit login.html.erb in a plugin

It would probably be as simple as adding this (which is what we do in show.html.erb)

<% if @title %>
  <% content_for :title do %><%= @title %><% end %>
  <% content_for :head do %>
    <%= raw crawlable_meta_data(title: @title, description: SiteSetting.site_description) %>
  <% end %>
<% else %>
  <% content_for :head do %>
    <%= raw crawlable_meta_data(title: SiteSetting.title, description: SiteSetting.site_description) %>
  <% end %>
<% end %>

I think all the data that gets used for OG Meta tags is already present on the login page… so I don’t think it’s omitted for privacy reasons or anything? Seems like we should add it.

7개의 좋아요

Agreed. Done in:

https://github.com/discourse/discourse/commit/553ffbfcb5eacc9cf2ae8669e4335539b8903fb3

6개의 좋아요