PHP code example of jansuchanek / nseo
1. Go to this page and download the library: Download jansuchanek/nseo library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jansuchanek / nseo example snippets
#[Inject]
public SeoManager $seoManager;
public function renderDetail(string $slug): void
{
$this->seoManager->setTitle('Product Name');
$this->seoManager->setDescription('Product description');
$this->seoManager->setCanonical($this->link('//detail', ['slug' => $slug]));
$this->seoManager->setOg('type', 'product');
// JSON-LD
$this->seoManager->addJsonLd([
'@type' => 'Product',
'name' => 'Product Name',
'offers' => ['@type' => 'Offer', 'price' => '299', 'priceCurrency' => 'CZK'],
]);
}