tractorcow/silverstripe-opengraph

Duplicated OG Tags?

Closed this issue · 1 comments

phptek commented

Note sure this is expected behaviour, but having installed the module with the suggested YML config found in the README's "Configuration" section, I'm seeing repeats of some OG tags.

This is the block of new metadata I now see in my page source:

<meta property="og:type" content="website" />
<meta property="og:url" content="https://localhost:8080/about-us/" />
<link rel="image_src" href="http://localhost:8080/assets/Uploads/giphy.gif" type="image/gif" />
<meta property="og:image" content="http://localhost:8080/assets/Uploads/giphy.gif" />
<meta property="og:image:secure_url" content="https://localhost:8080/assets/Uploads/giphy.gif" />
<meta property="og:image:type" content="image/gif" />
<meta property="og:description" content="You can fill this page out with your own content, or delete it and create your own pages. Edit edit edit. Test Edit" />
<meta property="og:site_name" content="My Rad-As site" />
<meta property="og:locale" content="en_NZ" />
<meta name="viewport" id="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=10.0,initial-scale=1.0">    
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta property="og:title" content="About Us | My Rad-As site" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://localhost:8080/about-us/" />
<meta property="og:site_name" content="My Rad-As site" />
<meta property="og:description" content="" />
<meta property="og:image" content="" />

I can see:

  • x2 og:type (with differing content)
  • x2 og:url (with differing content)
  • x2 og:image (with differing content)
  • x2 og:description (with differing content)
  • x2 og:site_name (with the same content)

Apologies, I'm evaluating the module and have only installed it, but how do OG consumers know which og:type or og:url to use (assuming they're not blank)?

Further Research:

If I implement the following method on Page, the second block with the repeats in, is no longer rendered and things look better, except that my custom method for returning an og:image no longer works:

    public function getOGType()
    {
        return null;
    }

Gives me:

<meta property="og:title" content="Home | My RAD As Site" />
<meta property="og:type" content="article" />
<meta property="og:url" content="https://localhost:8080/" />
<meta property="og:site_name" content="My RAD As Site" />
<meta property="og:description" content="" />
<meta property="og:image" content="" />

This is a little confusing. I'm not sure what is the correct behaviour :-/

#> composer info --locked --format json silverstripe/framework | jq '.versions[0]'
"4.12.3"
#> composer info --locked --format json tractorcow/silverstripe-opengraph | jq '.versions[0]'
"4.0.4"
phptek commented

I am an idiot. The site I was assessing this module on, wasn't as vanilla as I had thought.