twin-elements/seo-bundle

SEO bundle for CMS

Installs: 115

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

v1.1.0 2022-08-10 08:02 UTC

This package is auto-updated.

Last update: 2024-11-10 13:00:31 UTC


README

add TwinElements\SeoBundle\TwinElementsSeoBundle::class => ['all' => true], in bundles.php

add Seo to entity

/**
 * @ORM\Table(name="test")
 */
class Test implements SeoInterface
{
    use SeoTrait;
}

add Seo fields to forms

class TesteType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add('seo', SeoType::class);        
    }
}

add in form layout

{% use '@TwinElementsSeo/seo-fields.html.twig' %}

Displaying meta tags on the page

TestController extends AbstractController{
    public function test(SeoMetaGenerator $seoGenerator){
    
        $seo = new Seo();
    
        $seoGenerator->generate($seo, $url, $imageUrl);
        
    }
}