Feeds Integration (8.x)

Created on 3 November 2018, about 6 years ago
Updated 24 February 2023, almost 2 years ago

Metatag module currently doesn't have any integration for importing meta tags through the Feeds module. Initial patch to follow.

UPD: Patch expects that source string will be in JSON format.
E.g.:
{"title":"title value","description":"description value",...}

Feature request
Status

Needs work

Version

1.0

Component

Integration with other module

Created by

🇺🇦Ukraine artematem

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇳🇱Netherlands Summit

    Hi,
    Can this patch be used to import meta tags through feeds in Drupal 10?
    Thanks for your reply in advance!
    Greetings, Martijn

  • 🇺🇸United States DamienMcKenna NH, USA

    That is the intention, yes.

  • 🇮🇹Italy trickfun

    I apply this patch on
    metatag 2.0.0
    feed 8.x-3.0-beta4

    i get this error

    TypeError: array_merge(): Argument #2 must be of type array, null given in array_merge() (line 40 of modules/contrib/metatag/src/Feeds/Target/Metatag.php).
    Drupal\metatag\Feeds\Target\Metatag::prepareTarget(Object) (Line: 57)
    Drupal\feeds\Plugin\Type\Target\FieldTargetBase::targets(Array, Object, Array) (Line: 305)
    Drupal\feeds\Entity\FeedType->getMappingTargets() (Line: 105)
    Drupal\feeds\Form\MappingForm->buildForm(Array, Object, Object)
    call_user_func_array(Array, Array) (Line: 536)
    Drupal\Core\Form\FormBuilder->retrieveForm('feeds_mapping_form', Object) (Line: 283)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
    Drupal\Core\Controller\FormController->getContentResult(Object, Object)
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 592)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 121)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 182)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    

    i think feed integration is very important feature to have.
    thank you

  • Drupal 10
    metatag 2.0.0

    #38 Metatag.php replace lines 36-38 with:
    $metatag_basic = $metatag_manager->sortedGroupsWithTags()['basic']['tags'] ?? [];
    $metatag_og = $metatag_manager->sortedGroupsWithTags()['open_graph']['tags'] ?? [];
    $metatag_advanced = $metatag_manager->sortedGroupsWithTags()['advanced']['tags'] ?? [];

  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    305 pass, 31 fail
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 8
    last update 10 months ago
    305 pass, 31 fail
  • 🇳🇱Netherlands djschoone Breda

    #42 works. Made it into a new patch applied to

    • Drupal 10.2.4
    • Metatag 2.0.0
    • Feeds 8.x-3.0-beta4
  • 🇳🇱Netherlands djschoone Breda

    #42 works. Made it into a new patch applied to

    • Drupal 10.2.4
    • Metatag 2.0.0
    • Feeds 8.x-3.0-beta4
  • 🇺🇸United States Jared Nolt

    Patch #44 worked great in mapping Basic and Advanced schema fields! Would it be possible to map the Product Schema fields also?

  • 🇺🇸United States DamienMcKenna NH, USA

    For complex setups you might look at Schema.org Blueprints instead of Schema.org Metatag, it's far more flexible in how it works.

    I'm moving this to the 2.0.x branch, no further work is being done on the 8.x-1.x branch.

  • First commit to issue fork.
  • Merge request !110Draft: #3011202 add feeds integration → (Open) created by ptmkenny
  • 🇯🇵Japan ptmkenny

    Added a merge request with the code from patch #44 to make it easier to track future work.

  • Pipeline finished with Success
    8 months ago
    Total: 348s
    #145683
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.2.1 + Environment: PHP 8.1 & MySQL 8
    last update 7 months ago
    Unable to generate test groups
  • 🇵🇹Portugal tmiguelv

    Hello!
    In D11, I was getting the following error with the patch #44
    Error: Class "Drupal\Feeds\FieldTargetDefinition" not found in include() (line 11 of /app/docroot/modules/contrib/metatag/src/Feeds/MetatagFieldTargetDefinition.php).

    It turns out it was because the "Drupal\Feeds\FieldTargetDefinition" use statement was in the wrong case.

    I've changed "use Drupal\Feeds\FieldTargetDefinition;" to "use Drupal\feeds\FieldTargetDefinition;" and now it works.

  • 🇯🇵Japan ptmkenny

    @tmiguelv There is already an MR for this issue, and you can generate a patch from the MR. See downloading a patch file.

  • Pipeline finished with Failed
    about 1 month ago
    Total: 388s
    #319986
Production build 0.71.5 2024