Answer the question
In order to leave comments, you need to log in
How to add an open graph image for a site without a CMS?
I know that in cms plugins, it is possible to include og image randomly when it is taken for example from the text of the post, from the preview, etc.
I have a website in html, the number of pages is large. I make all mass changes through mass editing notepad ++ The
question is how to prescribe your og image to everyone, and not set the default one.
Answer the question
In order to leave comments, you need to log in
It all depends on the architecture of your project. If you pull the page completely, that is, pure HTML, then in each of your pages there will be a tag, respectively.
Then you just need to add the og-image meta tag
<head>
<title>Моя страница</title>
<meta property="og:image" content="https://site.ru/image.png"/>
<head>
<head>
<title>Моя страница</title>
<meta property="og:image" content="<?= $GLOBALS['og_image'] ?>"/>
</head>
<body>
<?php
# Определяем значение глобальной переменной
$GLOBALS['og_image'] = 'https://site.ru/image.png'
?>
<h1>Моя страница</h1>
</body>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question