Skip to content

Commit

Permalink
checking og
Browse files Browse the repository at this point in the history
  • Loading branch information
Ko71k committed Dec 4, 2024
1 parent c8db2d0 commit 6efca85
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions public/components/EventContentPage/EventContentPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,12 @@ export class EventContentPage {
const response = await api.get(path, request);
const event = await response.json();
this._renderEvent(event);
console.log(event);
document.querySelector("meta[property='og:title']").setAttribute("content", event.title);
document.querySelector("meta[property='og:description']").setAttribute("content", event.description);
document.querySelector("meta[property='og:image']").setAttribute("content", `${endpoint}/${event.image}`);
document.querySelector("meta[property='og:url']").setAttribute("content", `${endpoint}/event/${event.id}`);
document.querySelector("meta[property='og:type']").setAttribute("content", 'article');

} catch (error) {
console.log(error);
Expand Down
6 changes: 6 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>Выходной</title>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<meta property="og:title" content="Выходной" />
<meta property="og:description" content="Сайт для поиска мероприятий" />
<meta property="og:image" content="https://static.tildacdn.com/tild3064-6338-4337-b261-623761363462/999966666.png" />
<meta property="og:url" content="http://37.139.40.252/events" />
<meta property="og:type" content="website" />
<meta name='viewport' content='width=device-width, initial-scale=1'>
<link rel="stylesheet" href="/index.css"></link>
<script src="/modules/dompurify.js"></script>
</head>
Expand Down

0 comments on commit 6efca85

Please sign in to comment.