Git Product home page Git Product logo

sylius-seo-plugin's Introduction

Plugin SEO

Sylius SEO plugin by Dedi. Metadata, OpenGraph and RichSnippets (Breadcrumb and Product) for all Sylius resources.

About Dedi

At Dedi, we do not just create websites. We are building together a real digital strategy to combine your business requirements with our technical skills. We've been working with open source for a long time and decided to start giving back to the community by contributing and sharing some plugin of our own.

We’ll be happy to meet you, feel free to contact us. Learn more about us on our website.

Overview

docs/data/seo_plugin_example.png

This Plugin provides an almost plug and play solution for your SEO needs. It integrates Metadata, OpenGraph and RichSnippets (Breadcrumb and Product) on all shop pages.

It provides integration for Google Analytics and Google Tag Manager through your channel configuration.

Documentation

sylius-seo-plugin's People

Contributors

ehibes avatar fred-dedi avatar gaetanbuellet avatar julienloison avatar kevinbalicot avatar mneuville avatar pierre-dedi avatar semantic-release-bot avatar stefdedi avatar zambodaniel avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

sylius-seo-plugin's Issues

RichSnippetInterface is missing addData

Problem:
Interface Dedi\SyliusSEOPlugin\Domain\SEO\Model\RichSnippetInterface is missing addData() method which makes it inconsistent when trying to add more information to what factories return.

Solution:
Add the method public function addData(array $data): self to the interface

Other solution:
Since Product & Breadcrumb implementation do not have the same method to add. Perhaps another solution is to introduce 2 new interfaces ProductRichSnippetInterface and BreadcrumbRichSnippetInterface and typehint their factories to those new interfaces instead of the generic one

Definition Error in form.xml

After installation of your plugin I've got this error:
You have requested a non-existent parameter "dedi_sylius_seo_plugin.model.seo_content.class".

It's in the form.xml file.

Config:
Sylius 1.12
dedi/sylius-seo-plugin 1.2.4

Impossible to decorate ProductUrlGenerator

Problem:
When one decorates Dedi\SyliusSEOPlugin\Factory\SubjectUrl\ProductUrlGenerator with its custom implementation, the product show page breaks with the following error:

Dedi\SyliusSEOPlugin\Factory\ProductRichSnippetFactory::__construct(): Argument #6 ($productUrlGenerator) must be of type Dedi\SyliusSEOPlugin\Factory\SubjectUrl\ProductUrlGenerator, App\Factory\SubjectUrl\ProductUrlGenerator given

This is due to Dedi\SyliusSEOPlugin\Factory\ProductRichSnippetFactory typing its argument to Dedi\SyliusSEOPlugin\Factory\SubjectUrl\ProductUrlGenerator instead of Dedi\SyliusSEOPlugin\Domain\SEO\Factory\SubjectUrl\SubjectUrlGeneratorInterface

Proposed solution:
Type the argument to the interface instead of the class

Other solution:
An other workaround would be to not decorate, but extend the original service instead. But IMO the decoration should work properyl.

AllowEmptyString removed since Sylius 1.12/Symfony 6

Since Symfony 6 the allowEmptyString option from the Length constraint war remove.

Currently, if you try to edit a product, you will see this error :

The options "allowEmptyString" do not exist in constraint "Symfony\Component\Validator\Constraints\Length".

Maybe this can help to close this issue :

Before:

use Symfony\Component\Validator\Constraints as Assert;

/**

  • @Assert\Length(min=5, allowEmptyString=true)
    */
    After:

use Symfony\Component\Validator\Constraints as Assert;

/**

  • @Assert\AtLeastOneOf({
  • @Assert\Blank(),
    
  • @Assert\Length(min=5)
    
  • })
    */

Only use RichSnippet feature

Hi,

I have a use case where I don't need "Metadata & Opengraph" feature of this plugin, so I don't implement ReferenceableInterface / ReferenceableTrait on entities.

If I don't include ReferenceableTrait on Product or Channel entities, product and channel admin pages throw exceptions because of ProductTypeExtension and ChannelTypeExtension require referenceableContent field from ReferenceableTrait.

Do you think it is worth it to create a PR to manage this use case?

Rich Snippet usage for Product and Taxon entities

Hello,

Here my bug of the day, sry,

When i follow the install doc in

class Product
    ....
    public function getRichSnippetSubjectParent()

getRichSnippetSubjectParent must be compatible with interface RichSnippetSubjectInterface
so we replace by public function getRichSnippetSubjectParent(): ?self

But this function return a Taxon and not a Product so we have this error

Return value of App\Entity\Product\Product::getRichSnippetSubjectParent() must be an instance of App\Entity\Product\Product or null, instance of Proxies\__CG__\App\Entity\Taxonomy\Taxon returned

Thanks

Error on Add new static page

Hello
I have error when i try add new static page
An exception has been thrown during the rendering of a template ("No locale has been set and current locale is undefined.") in "@DediSyliusSEOPlugin/Admin/SEO/form_block_type.html.twig".

Anyone know how to fix it ??

Fatal error - Declaration must be compatible

Hello,

Here a missmatch declaration

Declaration of Dedi\SyliusSEOPlugin\DataCollector\RichSnippetsDataCollector::collect(Symfony\Component\HttpFoundation\Request $request, Symfony\Component\HttpFoundation\Response $response) must be compatible with Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface::collect(Symfony\Component\HttpFoundation\Request $request, Symfony\Component\HttpFoundation\Response $response, ?Throwable $exception = NULL) in /var/www/html/vendor/dedi/sylius-seo-plugin/src/DataCollector/RichSnippetsDataCollector.php on line 22

should be fix by:
public function collect(Request $request, Response $response, \Throwable $exception = null)

Sylius 1.9
Symfony 5

Best regards

Unable to find template

Hello,

I've the following error

Unable to find template "DediSyliusSEOPlugin:Shop/Header:_title.html.twig" (looked into: /var/www/html/vendor/knplabs/knp-menu/src/Knp/Menu/Resources/views, /var/www/html/templates, /var/www/html/templates, /var/www/html/vendor/symfony/twig-bridge/Resources/views/Form).

If I want to fix the error i need to replace into "src/Resources/config/ui.yaml"
dedi_seo_title: DediSyliusSEOPlugin:Shop/Header:_title.html.twig
by
dedi_seo_title: "@DediSyliusSEOPlugin/Shop/Header/_title.html.twig"

Sylius 1.9
Symfony 5

Best regards

API Platform

Hi ! Has anyone tested this plugin with API platform ?

I want to update SeoContent in taxon update route, but I have "Unable to generate an IRI for \"Dedi\\SyliusSEOPlugin\\Entity\\SEOContent\". Error.

With the Taxon GET Route, it's works

"referenceableContent": {
      "@id": "\/api\/v2\/admin\/seo-content\/2396",
      "@type": "SEOContent",
      "id": 2396,
      "translations": {
	      "fr_FR": {
		      "@id": "\/api\/v2\/admin\/seo-content-translations\/2139",
		      "@type": "SEOContentTranslation",
		      "id": 2139,
		      "notIndexable": false,
		      "metadataTitle": "Test",
		      "metadataDescription": "Test",
		      "openGraphMetadataTitle": "Test",
		      "openGraphMetadataDescription": "Test",
		      "openGraphMetadataUrl": null,
		      "openGraphMetadataImage": "Test",
		      "openGraphMetadataType": "website",
		      "locale": "fr_FR"
	      }
      }
},

Template overriding

Hello,

Little issue about template overriding. We cannot use template or theme overide through our projects.
We can only use Sylius event in order to override any of the plugin templates.

I mean, I need to override the sylius event and the block path template. We shouldn't do that.
We should do that following the documentation : https://docs.sylius.com/en/1.9/customization/template.html

Template event should be transformed from :
DediSyliusSEOPlugin:Shop/Header:_title.html.twig

To :
@DediSyliusSEOPlugin/Shop/Header/_title.html.twig

Thanks in advance

Attempted to call an undefined method named "getMasterRequest"

After install your plugin with sylius 1.12 and Symfony 6
I've got this error:

 In RichSnippetContext.php line 26:
!!                                                                                 
!!    Attempted to call an undefined method named "getMasterRequest" of class "Sy  
!!    mfony\Component\HttpFoundation\RequestStack".                                
!!    Did you mean to call e.g. "getMainRequest" or "getParentRequest"? 

Just change getMasterRequest by getMainRequest

Offers price invalid for Google Search Console

Hi !

Google Search Console says the price format is invalid for my products, probably for product variant price.
In HTML source, the variant price is formatted with a coma and I think Google expects a dot as separator :

image

image

Is there a solution ?

PS: My default locale is fr_FR, it may explains that problem...

Make it compatible with symfony 5

!! PHP Fatal error: Declaration of Dedi\SyliusSEOPlugin\DataCollector\RichSnippetsDataCollector::collect(Symfony\Component\HttpFoundation\Request $request, Symfony\Component\HttpFoundation\Response $response) must be compatible with Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface::collect(Symfony\Component\HttpFoundation\Request $request, Symfony\Component\HttpFoundation\Response $response, ?Throwable $exception = NULL) in source/vendor/dedi/sylius-seo-plugin/src/DataCollector/RichSnippetsDataCollector.php on line 22

For the error message the solution is something like that :

Before :

public function collect(Request $request, Response $response)

After :

public function collect(Request $request, Response $response, \Throwable $exception = null)

How to customize SEO on Taxon page?

Hi,
I installed the plugin and it works fine for Product and channel also.
Is there any way to customize seo on taxon page also like product page?

BO - Unable to find template

Hello,

Here a new bug, sry :'(

I've this error in admin when i go to products (list/add/edit) / Channel (add/edit) / Taxons (list/add/edit)

Unable to find template "@DediSyliusSEOPlugin/Resources/views/Admin/SEO/form_block_type.html.twig" (looked into: /var/www/html/vendor/dedi/sylius-seo-plugin/src/Resources/views).

In src/DependencyInjection/DediSyliusSEOExtension.php
replace
'@DediSyliusSEOPlugin/Resources/views/Admin/SEO/form_block_type.html.twig',
by
'@DediSyliusSEOPlugin/Admin/SEO/form_block_type.html.twig',

Symfony 5 / Sylius 1.9

Thanks.

Sku & Gtin fields for Variant

Since a SKU, or a GTIN number is supposed to identify a product in a unique way. Those properties should be defined at Variant level, and not at Product level.

Title shown in the header

After override the layout.html.twig file, i have this bug:
immagine

the products name (Frizione Energizzante Scalpo) is shown in the header bar (even in the title)
and the title in the header is inserted before the event.

any suggestion?
thanks

Error in INSTALL.md

Hello !

There is an error in the INSTALL.md file, at the section : "Rich Snippet usage for Product and Taxon entities".

It says to implement the "RichSnippetSubjectInterface" to product and taxon when it should be : "RichSnippetProductSubjectInterface".

(if I understood properly).

Cheers!

Edit: here is the error I get:
image

phpstan error

Hi,

I installed the plugin and it works fine. But when i run phpstan, i got following errors :

  • on Product.php : Method App\Entity\Product\Product::getRichSnippetSubjectParent() should return Dedi\SyliusSEOPlugin\Domain\SEO\Adapter\RichSnippetSubjectInterface|null but returns Sylius\Component\Core\Model\TaxonInterface|null.
  • on Taxon.php : Method App\Entity\Taxonomy\Taxon::getRichSnippetSubjectParent() should return Dedi\SyliusSEOPlugin\Domain\SEO\Adapter\RichSnippetSubjectInterface|null but returns Sylius\Component\Taxonomy\Model\TaxonInterface|null.

Is it a way to fix that ? I saw that the getMainTaxon return a TaxonInterface but the getRichSnippetSubjectParent return RichSnippetSubjectInterface

Thank you for the help

Unable to save product SEO fields

Sylius Version: 1.10.0
Symfony Version: 5.3.9

I've installed the plugin on my Sylius shop, and when i try to save some SEO values in the product page; i got the Sylius message "Product Updated".

But in my DB there's nothing saved in the tables.

How can i solve this?

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.