B
B
BuBux2020-05-07 11:41:02
PHP
BuBux, 2020-05-07 11:41:02

How to properly configure open graph for correct display?

I'm trying to write a CRM system. It has a task section. When a user copies a link to a specific task and pastes it into any messenger (in my case, Discord), the wrong thing is displayed. I read that open graph is for Facebook, but it doesn't display correctly there either.
HTML:

<html lang="en" xmlns:og="http://ogp.me/ns#">
    <head>
        <meta charset="utf-8" />
        <title><?=$title?> | <?=$site['name']?></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
        <meta content="<?=$description?>" name="description" />

        <meta property="og:title" content="<?=$og_title?>" />
        <meta property="og:type" content="website" />
        <meta property="og:url" content="http://<?=$site_url?>" />
        <meta property="og:site_name" content="название компании" />
        <meta property="og:image" content="http://domen.ua/template/assets/images/logo_sm.png" />
        
        <!--подключение стилей-->
    </head>


PHP:
public function actionView($id) {
        $title = 'Просмотр задачи - ' . $task[0]['NAME'];
  $site_url = $site['url'] . $_SERVER['REQUEST_URI'];
  $og_title = $task[0]['NAME'];
  $description = $task[0]['NAME'];
}

I write in php and use the MVC architecture. In this example, I dropped the controller to preview the task. When I link to this preview, the markup is drawn with the wrong data that I pass. Passing data from the authorization page.
Where is the mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-05-07
@efir

Is the task data available to an authorized user? Since they will be visible to other systems that are not authorized in the system

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question