A
A
Anton2020-10-15 19:29:28
open graph
Anton, 2020-10-15 19:29:28

Open Graph - who implemented it, have questions, how is it implemented for different pages of the site?

Hello.

Who did the Open Graph markup for social networks.
Today I got carried away, read various articles, etc., but they seemed to be copied under a blueprint.
I understood how to do it for the main one, but how to do it for other pages if I don’t have an html page, but a site with an admin panel.

Questions:

1) Is it important to stuff tags into html? like this

(<html lang="ru" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">)
.

2) About
<meta property="og:title" content="<?= $title ?>"/>
and others where the description and url of the page, as I understand it, in order to do it for all pages, you need to make a code that determines which page we are on and so that the <meta property="og:url" content= " " />url of the page I am on is automatically substituted in the field, is it better to do it?

There are no problems with the title, description, I just stuffed the code, which displays these meta tags and that's it. Now what is the title on the page and the description, it also displays in these tags for social networks.

3) What about the picture? <meta property="og:image" content=" "/>, let's say there is no picture on the main page and I stuffed a link there, made a picture, but what if there are pictures in the texts on other pages, then what to do with it? if we admit I want that on other pages the picture from content undertook.

4) Is this enough for a tweet? (or something else is missing).
<meta name="twitter:title" content=" " />
<meta name="twitter:description" content=" " />
<meta name="twitter:url " content=" " />
<meta name="twitter:cart" content="summary" />


5) About html, if I'm in an article, then I read that you need to add more meta to html here,
<html lang="ru" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
, it is important?

Here I think how all this is convenient and better to implement. Well, of course, it’s more correct, so let’s say if I’m in the article and there are pictures there, and in general, if in the article you need to change the tag <meta property="og:type" content="website" />, instead of website, it’s different there. It’s also necessary to somehow define the page and substitute another input option for it in this field, well, plus insert the code that will display the picture in this tag <meta property="og:image" content=" "/>, but it’s not clear how the dimensions will be determined ____), or better where there is a picture, stupid remove this meta <meta property="og:image" content=" "/>.

In general, experts, tell me how you implement, what you put, maybe where there is a video sensible about this or an article. Where everything will be laid out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
OCTAGRAM, 2020-10-16
@OCTAGRAM

so that in the field 《meta property="og:url" content= " " /》 automatically substitute the url of the page on which I am, is it better to do this?

There should be a canonical URL, and only the webmaster knows how to form it correctly. There should not be any CloudFlare-hCaptcha clearance and UTM parameters.
As for the picture, I made the following logic: on the main page, the default picture and the twitter card mode are large. On other pages, if there is an individual image, the twitter card is also large, otherwise the default image is on a small card.
As for the title, in a regular title it can look like “Article Title - Site Title”, and for social networks it is split into parts
change the tag 《meta property="og:type" content="website" /》 instead of website, it's different.

if URL_Pathname = "/" then
         Append
           (Response_Message_Body,
            "   <meta property=""og:type"" content=""website"" />" & LF);
      else
         Append
           (Response_Message_Body,
            "   <meta property=""og:type"" content=""article"" />" & LF);
      end if;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question