Git Product home page Git Product logo

grav-plugin-social-seo-metatags's People

Contributors

arkhi avatar cherrydt avatar clemdesign avatar damienbry avatar pamtbaau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

grav-plugin-social-seo-metatags's Issues

howto personalize description for a specific page ?

Hi Clement;

I wonder if it's possible to define a description for a page
example:
I'm able to specify a description for twitter by adding

metadata:
    'twitter:description': 'description for twitter'

but unable to do the same thing for <meta name="description"
I try both :

description: description generale

and

metadata:
    'description': 'description generale'

Description from frontmatter header shall be defined 3 times for each metatag: It's boring

Current behavior:

To define description, twitter:description and og:description, each meta-tag shall be defined in header frontmatter like this:

metadata:
    description: 'Description of page'
    'twitter:description': 'Description of page'
    'og:description': 'Description of page'

This operation is boring.

Expected behavior

Good deal is to avoid this repetition and define directly in frontmatter configuration the field description which used if defined, like this:

description: 'Description of page'
metadata:
    <other fields>

This solution keep compatibility for metadata overwritting.

403

I am getting a 403 in the admin page when editting the setings
Screenshot 2019-06-08 at 22 38 36

Facebook link preview fails with og tags set and gzip off

On this grav site: http://istenieroforras.igehirdetes.ma/ the og image tag, etc. seems to be set right, gzip compression is disabled as it can be seen also from https://checkgzipcompression.com/?url=http%3A%2F%2Fistenieroforras.igehirdetes.ma%2F.

Why facebook won’t load any image for any of this site’s pages? No title, no images, nothing. What is wrong with this site? Tried to debug it with facebook’s tool, waited for weeks to change, these didn’t help.

[Bug] Reverse proxy internal port number in meta links

I serve multiple sites on this server, and so I use a reverse proxy to mask the port number (nginx proxy_pass). Works fine, except for this plugin does this
<meta property="og:url" content="https://blog.example.com:9093/philosophy/topic" />
instead of
<meta property="og:url" content="https://blog.example.com/philosophy/topic" />
Also it adds the port to og:image and twitter:title

(Not sure how you're building the link but in PHP there's a difference between the various $_SERVER hostname vars, some with ports, some without, make sure you use the right one)

With header_image_file, plugin still gets the first image

Hi. As you closed the later issue, I need to open this new one with the same title. I know you didn't like my PR after you asked to see it. As I said, not a PHP dev. Anyway, I find out a better way to fix this. In this line:

$antimatterFile = $page->header()->header_image_file;

use this:

$antimatterFile = $page->path() . '/' . $page->header()->header_image_file;

That would fix the issue. Thanks for considering.

Hyphens are missing from description

For example, a page with summary "SAN JOSE — Jonny Brodzinki is riding high on a huge wave of goals. He powered the San Jose Barracuda with two goals in a 5-1 convincing victory over the Iowa Wild on Wednesday evening at SAP Center." gets displayed as "SAN JOSE — Jonny Brodzinki is riding high on a huge wave of goals. He powered the San Jose Barracuda with two goals in a 51 convincing victory over the Iowa Wild on Wednesday evening at SAP Center." in Facebook and Twitter.

Of course, a "51 convincing victory" doesn't make a lot of sense.

It seems that the sanitizeMarkdowns function is causing this problem.

[Docs] Clarity on facebook setup

We are instructed to add this line
(config.plugins['social-seo-metatags'].enabled and config.plugins['social-seo-metatags'].social_pages.pages.facebook.enabled) ? 'xmlns:og="http://ogp.me/ns#"' : ''
to our "base template" -- please give more information. What and where is the base template? Is it part of my theme? Can it be edited from grav, or do I need to ssh into the server install? What is the exact path of this file?

Apostrophe in title not well handled.

One of my pages has an apostrophe in the title:
Roger's Books
and this ends up in the tags as '
It is the correct translation but it isn't right when twitter displays it because twitter leaves it at Roger's Books
The problem is in the social-seo-metatags.php file at the end of the sanitizeMarkdowns funtions. I changed the call to htmlspecialcharacters to use ENT_COMPAT rather than ENT_QUOTES and it worked fine. You might want to do something similar, or make it an option.

Undefined variable $path

Hi,
I get the critical error "Undefined variable: path" on Grav 1.7.7 and the plugin version 2.1.0 .
The stack-trace is

/var/www/html/developers-t6/system/src/Grav/Common/Debugger.php(843): Whoops\Run->handleError()
/var/www/html/developers-t6/user/plugins/social-seo-metatags/social-seo-metatags.php(281): Grav\Common\Debugger->deprecatedErrorHandler()
/var/www/html/developers-t6/user/plugins/social-seo-metatags/social-seo-metatags.php(313): Grav\Plugin\SocialSEOMetaTagsPlugin->getDefaultImage()
/var/www/html/developers-t6/user/plugins/social-seo-metatags/social-seo-metatags.php(104): Grav\Plugin\SocialSEOMetaTagsPlugin->getTwitterCardMetatags()
/var/www/html/developers-t6/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Grav\Plugin\SocialSEOMetaTagsPlugin->onPageInitialized()
/var/www/html/developers-t6/vendor/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch()
/var/www/html/developers-t6/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
/var/www/html/developers-t6/system/src/Grav/Common/Grav.php(550): Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
/var/www/html/developers-t6/system/src/Grav/Common/Processors/PagesProcessor.php(44): Grav\Common\Grav->fireEvent()
/var/www/html/developers-t6/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\PagesProcessor->process()

It seems like adding $path = null in the beginning of getDefaultImage() solves it, but feels like it should have other side-effects as well.
Do you have any idea of what's going on? Thanks in advance!

3.0.0 Argument #1 ($image) must be of type Grav\Common\Page\Medium\ImageMedium, null given

Hi,
thank you for providing this plugin.

My plugin was automatically updated and is now throwing an error:

0 - Grav\Plugin\SocialSEOMetaTagsPlugin::getImage(): Argument #1 ($image) must be of type Grav\Common\Page\Medium\ImageMedium, null given, called in /var/www/html/xxx/user/plugins/social-seo-metatags/social-seo-metatags.php on line 326

Is there any migration needed for the new version?

Using cached images

Hi. Would it be possible to add an option to use cached images on the og:image and twitter:image? For example, I got it replacing

$image->url()

with

$image->cache()->url()

Thanks for considering.

Add blog header image into getFirstImage function

Hi! I would like to suggest you to add some check if the page have the blog header image (header_image_file) before getting the image list. I have made a very dirty solution here at the getFirstImage function (at line 231 of social-seo-metatags.php), but I am sure you could make a good implementation. With this, both twitter and og tags would use the header image if present.

Thanks for considering.

3.0.1 - E_WARNING - Undefined variable $image

Hi,
after trying out 3.0.1 (because of #26) another error occurs:

Server Error

Sorry, something went terribly wrong!
E_WARNING - Undefined variable $image
For further details please review your logs/ folder, or enable displaying of errors in your system configuration.
[2021-11-09 08:43:01] grav.CRITICAL: Undefined variable $image - Trace: #0 /var/www/html/XXX/system/src/Grav/Common/Debugger.php(843): Whoops\Run->handleError(2, Undefined varia..., /var/www/html/m..., 364) #1 /var/www/html/XXX/user/plugins/social-seo-metatags/social-seo-metatags.php(364): Grav\Common\Debugger->deprecatedErrorHandler(2, Undefined varia..., /var/www/html/m..., 364) #2 /var/www/html/XXX/user/plugins/social-seo-metatags/social-seo-metatags.php(391): Grav\Plugin\SocialSEOMetaTagsPlugin->getDefaultImage() #3 /var/www/html/XXX/user/plugins/social-seo-metatags/social-seo-metatags.php(103): Grav\Plugin\SocialSEOMetaTagsPlugin->getTwitterCardMetatags(Array) #4 /var/www/html/XXX/vendor/symfony/event-dispatcher/EventDispatcher.php(264): Grav\Plugin\SocialSEOMetaTagsPlugin->onPageInitialized(Object(RocketTheme\Toolbox\Event\Event), onPageInitializ..., Object(Symfony\Component\EventDispatcher\EventDispatcher)) #5 /var/www/html/XXX/vendor/symfony/event-dispatcher/EventDispatcher.php(239): Symfony\Component\EventDispatcher\EventDispatcher->doDispatch(Array, onPageInitializ..., Object(RocketTheme\Toolbox\Event\Event)) #6 /var/www/html/XXX/vendor/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, onPageInitializ..., Object(RocketTheme\Toolbox\Event\Event)) #7 /var/www/html/XXX/system/src/Grav/Common/Grav.php(564): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(RocketTheme\Toolbox\Event\Event), onPageInitializ...) #8 /var/www/html/XXX/system/src/Grav/Common/Processors/PagesProcessor.php(46): Grav\Common\Grav->fireEvent(onPageInitializ..., Object(RocketTheme\Toolbox\Event\Event)) #9 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\PagesProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #10 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #11 /var/www/html/XXX/system/src/Grav/Common/Processors/TwigProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #12 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\TwigProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #13 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #14 /var/www/html/XXX/system/src/Grav/Common/Processors/AssetsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #15 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\AssetsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #16 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #17 /var/www/html/XXX/system/src/Grav/Common/Processors/SchedulerProcessor.php(40): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #18 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\SchedulerProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #19 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #20 /var/www/html/XXX/system/src/Grav/Common/Processors/BackupsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #21 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\BackupsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #22 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #23 /var/www/html/XXX/system/src/Grav/Common/Processors/TasksProcessor.php(69): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #24 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\TasksProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #25 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #26 /var/www/html/XXX/system/src/Grav/Common/Processors/RequestProcessor.php(63): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #27 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\RequestProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #28 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #29 /var/www/html/XXX/system/src/Grav/Common/Processors/ThemesProcessor.php(38): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #30 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\ThemesProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #31 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #32 /var/www/html/XXX/system/src/Grav/Common/Processors/PluginsProcessor.php(39): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #33 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\PluginsProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #34 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #35 /var/www/html/XXX/system/src/Grav/Common/Processors/InitializeProcessor.php(130): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #36 /var/www/html/XXX/system/src/Grav/Common/Debugger.php(546): Grav\Common\Processors\InitializeProcessor::Grav\Common\Processors\{closure}() #37 /var/www/html/XXX/system/src/Grav/Common/Processors/InitializeProcessor.php(131): Grav\Common\Debugger->profile(Object(Closure)) #38 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(50): Grav\Common\Processors\InitializeProcessor->process(Object(Nyholm\Psr7\ServerRequest), Object(Grav\Framework\RequestHandler\RequestHandler)) #39 /var/www/html/XXX/system/src/Grav/Framework/RequestHandler/Traits/RequestHandlerTrait.php(62): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #40 /var/www/html/XXX/system/src/Grav/Common/Grav.php(303): Grav\Framework\RequestHandler\RequestHandler->handle(Object(Nyholm\Psr7\ServerRequest)) #41 /var/www/html/XXX/index.php(58): Grav\Common\Grav->process() #42 {main} [] []

metadata description for specific page only partly works

This is the metadata on my page:

metadata:
author: 'Roger J Parkinson'
description: 'Discusses whether animals feel pain or is that an anthropological illusion.'
keywords: animals, neurons, emotion

This is the result:

<meta name="description" content="There was a piece in our local news feed about a vet who, among other things, maintained that animals do not feel pain. This idea comes up surprisingly often, what is unusual is that this time it is from…" />
<meta name="keywords" content="animals, neurons, emotion" />
<meta name="author" content="Roger J Parkinson" />
<meta property="og:description" content="There was a piece in our local news feed about a vet who, among other things, maintained that animals do not feel pain. This idea comes up surprisingly often, what is unusual is that this time it is from…" />
<meta property="og:title" content="Do Animals Feel Pain? | Roger Parkinson" />
<meta property="twitter:card" content="summary_large_image" />
<meta name="twitter:title" property="twitter:title" content="Do Animals Feel Pain?" />
<meta name="twitter:description" property="twitter:description" content="Discusses whether animals feel pain or is that an anthropological illusion." />

The 'description' and the 'og:description' have used the first 160 characters of the text, and only the twitter:description has used the description I added to the page metadata. I tried adding 'og:description' to the page metadata but that made no difference. Is there a way to have them all consistent?

og:tag not repeated for each keyword

The open graph spec says that keywords should be specified like this:

<meta property="og:tag" content="Books" />
<meta property="og:tag" content="Fantasy" />
<meta property="og:tag" content="Dragons" />
<meta property="og:tag" content="Sheep" />
<meta property="og:tag" content="Cats" />

But the plugin only does this:

<meta name="keywords" content="Books, Fantasy, Dragons, Sheep, Cats" />

Both would be good. I added this code to your php file at the end of onPageInitialized()

    $tagArray = explode(',', $meta['keywords']['content']);
    foreach ($tagArray as $t) {
      $meta['tag'.trim($t)]['property'] = 'og:tag';
      $meta['tag'.trim($t)]['content'] = trim($t);
    }
    //Set new meta to the page
    $page->metadata($meta);

It does work but I'm not good at php so there is likely a better way.

Twitter: double @

In the plugin's admin tab Twitter Cards, the Username placeholder is @, suggesting to put the username in the format @username.

However, using this format results in a double @ in the metatag :

<meta name="twitter:site" property="twitter:site" content="@@username" />

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.