Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note

TODO - BE documentation and review of this documentation is needed

Product Page

Get current metadata template and add open graph tags to existing tags

vendor/creativestyle/magesuite-opengraph/Plugin/Framework/View/Page/Config/Renderer/AddTagsToHeadMeta.php:39
Code Block
breakoutModewide
class AddTagsToHeadMeta
{
    public function afterRenderMetadata(\Magento\Framework\View\Page\Config\Renderer $subject, $result)
    {
        .....
        $tags = $this->tagsCollector->getTags($pageType);
        .....
        foreach ($tags as $name => $value) {
            .....
            $metadataTemplate = $this->getMetadataTemplate($name);
            .....
            $result .= str_replace(['%name', '%content'], [$name, $value], $metadataTemplate);
        }

        return $result;
    }
}

Get open graph tags

vendor/creativestyle/magesuite-opengraph/Service/TagsCollector.php:17
Code Block
breakoutModewide
class TagsCollector
{
    public function getTags($pageType = null)
    {
        .....
        $dataProviders = $this->sortProviders($this->dataProviders[$pageType]);

        $tags = [];
        foreach ($dataProviders as $dataProvider) {
            $dataProviderClass = $dataProvider['class'];
            .....
            $tags = $this->mergeTags($tags, $dataProviderClass->getTags());
        }

        return $tags;
    }
}

Get general open graph tags, for example:

Code Block
breakoutModewide
og:title = "Damen-T-Shirt mit Rundhalsausschnitt  | NKD"
og:description = "Mode-Basic: Dieses Damen-T-Shirt von Laura Torelli Collection ist wirklich unverzichtbar. Mit seinem schlichten, einfarbigen Design lässt es sich nach Herzenslust zu farbenfrohen Hosen, Röcken oder Strickjacken kombinieren. Erleben Sie außerdem"
og:image = "http://magesuite.me/static/version1698066273/frontend/Creativestyle/theme-nkd/de_DE/images/logo.svg"
og:image:type = "image/svg+xml"
og:image:alt = "NKD Deutschland GmbH"
og:url = "http://magesuite.me/de_de/id/242392/"
og:locale = "de_DE"

...

Code Block
class General extends TagProvider implements TagProviderInterface
{
    public function getTags()
    {
        $this->addFbAppIdTag();
        $this->addTitleTag();
        $this->addDescriptionTag();
        $this->addImageTag();
        $this->addUrlTag();
        $this->addLocaleTag();

        return $this->tags;
    }
}

Get product tags

vendor/creativestyle/magesuite-opengraph/Mapper/Product.php:14

...