Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Bb Seo Ezplatform Bundle Laravel Package

bruyerefreelance/bb-seo-ezplatform-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require bruyerefreelance/bb-seo-ezplatform-bundle
    

    Add the bundle to app/AppKernel.php under registerBundles():

    new BruyereFreelance\SeoExtensionBundle\BruyereFreelanceSeoExtensionBundle(),
    
  2. Basic Configuration Define content types (e.g., article, page_simple) in app/config/config.yml:

    bruyere_freelance_seo_extension:
        content_type_identifier: ['article', 'page_simple']
    
  3. First Use Case

    • Edit a content item of the configured type (e.g., article).
    • A new tab or field group (depending on UI implementation) for SEO metadata (title, description) should appear.
    • Fill in SEO fields directly in the eZ Platform admin interface.

Implementation Patterns

Workflow Integration

  1. Content Creation/Editing

    • Extend the eZ Platform content edit form to include SEO fields.
    • Use the bundle’s field types (if provided) or custom fields for meta_title and meta_description.
    • Example: Override the ContentController to inject SEO fields into the edit form:
      // src/Acme/YourBundle/Controller/ContentController.php
      public function editAction(Content $content)
      {
          $form = $this->createFormBuilder($content)
              ->add('meta_title', TextType::class, ['required' => false])
              ->add('meta_description', TextareaType::class, ['required' => false])
              ->getForm();
          // ...
      }
      
  2. SEO Data Persistence

    • Store SEO metadata in custom fields or a separate table (if the bundle doesn’t handle this natively).
    • Example: Add fields to your content type via eZ Platform’s field definition:
      # config/ezplatform/content_types/article.yml
      fields:
          meta_title:
              type: ezstring
              position: 100
          meta_description:
              type: eztext
              position: 101
      
  3. Rendering SEO Tags

    • Override the Twig template for content rendering to inject <title> and <meta> tags.
    • Example: Extend the base template (Resources/views/Content/content.html.twig):
      {% block meta_tags %}
          {% if content.getField('meta_title') is not empty %}
              <title>{{ content.getField('meta_title').value }}</title>
          {% endif %}
          {% if content.getField('meta_description') is not empty %}
              <meta name="description" content="{{ content.getField('meta_description').value }}">
          {% endif %}
      {% endblock %}
      
  4. API/Headless Use

    • Fetch SEO data via the eZ Platform REST API or GraphQL.
    • Example: Extend the API response for content items:
      // src/Acme/YourBundle/EventListener/ApiEventListener.php
      public function onContentGet(ContentGetEvent $event)
      {
          $content = $event->getContent();
          $seoData = [
              'meta_title' => $content->getField('meta_title')?->value,
              'meta_description' => $content->getField('meta_description')?->value,
          ];
          $event->setData(array_merge($event->getData(), ['seo' => $seoData]));
      }
      

Gotchas and Tips

Pitfalls

  1. Bundle Maturity

    • The bundle is under development (as stated in the README). Expect breaking changes or missing features.
    • Verify compatibility with your eZ Platform version (e.g., 6.x) and test thoroughly.
  2. Field Configuration

    • If the bundle doesn’t auto-create fields, manually add meta_title and meta_description to your content types.
    • Ensure field identifiers match those referenced in content_type_identifier (e.g., article).
  3. Caching Issues

    • SEO metadata may not reflect changes immediately due to caching (e.g., Twig, HTTP, or eZ Platform’s content cache).
    • Clear caches after updates:
      php bin/console cache:clear
      
  4. Missing Documentation

    • The bundle lacks detailed docs. Reverse-engineer usage by inspecting:
      • BruyereFreelance\SeoExtensionBundle\DependencyInjection\ for configuration logic.
      • Resources/config/services.yml for service definitions.

Debugging Tips

  1. Check Configuration

    • Validate content_type_identifier includes all target content types:
      bruyere_freelance_seo_extension:
          content_type_identifier: ['article', 'page_simple', 'product']  # Add all needed types
      
  2. Verify Field Existence

    • Ensure SEO fields exist in the database and are mapped to content items:
      php bin/console ezplatform:content:list --type=article
      
    • Look for meta_title/meta_description in the output.
  3. Override Default Behavior

    • If the bundle doesn’t render SEO tags, manually inject them in your theme:
      {% extends 'ezdesign:layout.html.twig' %}
      {% block head %}
          {{ parent() }}
          {% include 'AcmeYourBundle:Content/seo_tags.html.twig' with { content: content } %}
      {% endblock %}
      
  4. Extension Points

    • Extend the bundle by creating a custom event subscriber:
      // src/Acme/YourBundle/EventSubscriber/SeoSubscriber.php
      class SeoSubscriber implements EventSubscriberInterface
      {
          public static function getSubscribedEvents()
          {
              return [
                  KernelEvents::VIEW => ['onKernelView', 100],
              ];
          }
      
          public function onKernelView(ViewEvent $event)
          {
              $content = $event->getControllerResult();
              if ($content instanceof Content) {
                  $event->getController()->get('twig')->addGlobal('seo_data', [
                      'title' => $content->getField('meta_title')?->value,
                      'description' => $content->getField('meta_description')?->value,
                  ]);
              }
          }
      }
      
  5. Fallback for Missing Data

    • Provide default SEO values (e.g., page title + site name) if fields are empty:
      <title>
          {% if content.getField('meta_title') is empty %}
              {{ content.getName() }} - {{ site.name }}
          {% else %}
              {{ content.getField('meta_title').value }}
          {% endif %}
      </title>
      
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle