staempfli / magento2-module-seo Goto Github PK
View Code? Open in Web Editor NEWMagento 2 Module for Search Engine Optimization
Magento 2 Module for Search Engine Optimization
Hello guys,
I have installed this module in Magento 2.1.15 and I get this error:
Exception #0 (Exception): Warning: Missing argument 3 for Staempfli\Seo\Plugin\RouteConfigPlugin::afterGetModulesByFrontName(), called in /lib/internal/Magento/Framework/Interception/Interceptor.php on line 152 and defined in /vendor/staempfli/magento2-module-seo/Plugin/RouteConfigPlugin.php on line 19
Any idea?
Hi, I'm upgrading to Magento 2.4, but this module is causing my upgrade to fail since there is no newer version. Is it possible to add support to 2.4, or this project is abandoned?
Hi,
We set different stores in Magento 2. When we choose flat category option, the function getAlternatives:
staempfli/magento2-module-seo/Block/HrefLang.php Line 39-43
public function getAlternatives()
{
$data = [];
foreach ($this->getStores() as $store) {
if ((!$this->isCurrentStore($store)) && $url = $this->getStoreUrl($store)) {
$data[$this->getLocaleCode($store)] = $url;
}
}
return $data;
}
will cause
magento/module-catalog/Model/CategoryRepository.php 141
to throw exception:
public function get($categoryId, $storeId = null)
{
$cacheKey = null !== $storeId ? $storeId : 'all';
if (!isset($this->instances[$categoryId][$cacheKey])) {
/** @var Category $category */
$category = $this->categoryFactory->create();
if (null !== $storeId) {
$category->setStoreId($storeId);
}
$category->load($categoryId);
if (!$category->getId()) {
throw NoSuchEntityException::singleField('id', $categoryId);
}
$this->instances[$categoryId][$cacheKey] = $category;
}
return $this->instances[$categoryId][$cacheKey];
}
It will load category from flat category table for a specific store(For example:catalog_category_flat_store_5) but not the category table for all stores. It will return empty result and cause CategoryRepository.php to throw exception.
Hola All,
The type hints in the AlternativeUrlService are against a specific implementation class rather than an interface. Accordingly, with the strict type hitns, we can't replace the class. See
Ideally I would replace these with interfaces, and set a preference to consume the implementation in this interface. This would allow a nice clean override of that class as required, with another that implemented the required interface.
For now, this DI doesn't 'work:
<?xml version="1.0" encoding="UTF-8" ?>
<!--
/**
* An extension that creates an association between CMS pages of different stores, such that the appropriate redirects
* or links can be mapped.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
<preference for="Staempfli\Seo\Service\HrefLang\CmsPageUrlRetriever"
type="Sitewards\Seo\Service\HrefLang\CmsPageUrlRetriever
CmsPageUrlRetriever" />
</config>
The class does implement an interface, but because 4 different types of concrete implementation implement that interface we can't modify the type hints there either.
I need to set a specific twitter:description and og:description tags for homepage, but i can't override your vendor\staempfli\magento2-module-seo\Model\Property.php
class into my local pool, since is being declared as final. Is there any way to modify Property class behaviour?
In the hreflanguage list the x-default one is missing, is there any way to implement it?
Hi! I'd like to know if the extension is compatible with Magento 2.3.x.
Thanks!
I am not able to share product image to Twitter cause as pointed in different post regarding this problem (but not specifically with Magento2 and your extension) Twitter has changed twitter:image
to twitter:image:src
where do I change this?
Hi, can you add a tag on master branch so that we don't have to use dev-master as composer version? It's really unsecure to use dev-master. The last tag is a bit outdated and hasn't some fixes and features
Hi,
I found an error on hreflang url in all product page.
The hreflang url not include the category path.
This is my solution at the problem, and work for me. ;-)
Fixed file:
magento/vendor/staempfli/magento2-module-seo/Service/HrefLang/ProductUrlRetriever.php
namespace Staempfli\Seo\Service\HrefLang;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Catalog\Model\Product;
use Magento\CatalogUrlRewrite\Model\ProductUrlPathGenerator;
use Magento\Store\Model\Store;
use Staempfli\Seo\Api\ProductUrlRetrieverInterface;
use Staempfli\Seo\Service\HrefLang\CategoryUrlRetriever; //FIX
class ProductUrlRetriever implements ProductUrlRetrieverInterface
{
/**
* @var ProductRepositoryInterface
*/
private $productRepository;
/**
* @var ProductUrlPathGenerator
*/
private $productUrlPathGenerator;
/**
* @var CategoryUrlRetriever
*/
private $categoryUrlRetriever;
public function __construct(
ProductRepositoryInterface $productRepository,
ProductUrlPathGenerator $productUrlPathGenerator,
CategoryUrlRetriever $categoryUrlRetriever
) {
$this->productRepository = $productRepository;
$this->productUrlPathGenerator = $productUrlPathGenerator;
$this->categoryUrlRetriever = $categoryUrlRetriever; //FIX
}
/**
* @param int $identifier the product ID
* @param Store $store
* @return string
*/
public function getUrl($identifier, $store)
{
/** @var Product $product */
$product = $this->productRepository->getById($identifier, false, $store->getId());
$path = $this->productUrlPathGenerator->getUrlPathWithSuffix($product, $store->getId());
//FIX
if(!empty($product->getCategoryId())) {
$categoryUrl = $this->categoryUrlRetriever->getUrl($product->getCategoryId(), $store);
if(!empty($categoryUrl)) {
return $categoryUrl . '/' . $path;
}
}
return $store->getBaseUrl() . $path;
}
}
I don't have hreflang on my homepage, made a PR#8 for review.
Unfortunately isn't compatible with magento 2.4.x, which really would be beneficial
\Staempfli\Seo\Model\Property::getFilteredInput
filters data incorrectly when using non-english characters in product description, which causes
\Staempfli\Seo\Model\Property::setDescription
to set og:description and twitter:description to the value containing non-utf8 character. This non-utf8 character crashes Magento2 when trying to execute
\Magento\Framework\App\PageCache\Kernel::process:151
Example product description:
<p>Kurtka robocza HAMMER z odpinanymi rękawami co daje nam bezrękawnik.</p>
<p><strong>Charakterystyka:</strong></p>
<ul>
<li>Gramatura: 270 g/m2</li>
<li>Kurtka wykonana z T/S 35% bawełna / 65% poliester</li>
<li>Dodatki wzmacniające wykonane z materiału odpornego na ścieranie/rozerwanie - oxford</li>
<li>Posiada odpinane rękawy</li>
<li>Kolor: szary</li>
</ul>
<p><strong>Zastosowanie:</strong></p>
<ul>
<li>Prace budowlane</li>
<li>Terenowe</li>
<li>W warsztatach samochodowych</li>
</ul>
html meta tag generated by Staempfli\Seo module:
<meta property="og:description" content="Kurtka robocza HAMMER z odpinanymi rękawami co daje nam bezrękawnik.Charakterystyka:Gramatura: 270 g/m2Kurtka wykonana z T/S 35% bawełna / 65% poliesterDodatki wzmacniające wykonane z materia� ..." />
"staempfli/magento2-module-seo": "^1.7"
Magento 2.x
Exception #0 (InvalidArgumentException): Unable to serialize value. Error: Malformed UTF-8 characters, possibly incorrectly encoded
PDP loads correctly.
PDP throws exception.
Is there a way to get this module to display href alternate lang tags for pages at website scope levels?
I have Magento 2 setup like this:
website 1: example.com/gb (UK website)
website 2: example.com/us (US website)
website 2: example.com/fr (France website)
website 3: example.com/de (Germany website)
The categories, menu and products are all identical. They have just been translated to accommodate more languages.
Hi,
Your module seems to exclude the current store for the alternate links even though it is specified in google that it must list itself.
Our SEO specialist is also confirming this.
Google documentation on alternate links: "Each language version must list itself as well as all other language versions"
https://support.google.com/webmasters/answer/189077?hl=en
Code involved:
magento2-module-seo/Block/HrefLang.php
Line 40 in d5e6370
Hi,
Thank you for the work on this module!
When will you merge the latest changes on the develop branch to the master branch? For example, this commit seems ready to release.
Original function parameters can be passed to after
plugins only in Magento versions >=2.2.0
.
This plugin added on version 1.6.2 is not compatible with previous versions.
See also:
A quick solution will probably be to use around
plugin instead as it has the same format in all Magento versions
The sitemap URL in the robots.txt
file always includes the pub
directory. If the pub
directory is configured as the document root as recommended by Magento, this leads to a wrong URL.
Expected: https://www.shop.tld/media/sitemap.xml
Actual: Expected: https://www.shop.tld/pub/media/sitemap.xml
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.