1. Go to this page and download the library: Download milankyncl/nette-seo 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/ */
milankyncl / nette-seo example snippets
// With @inject annotation:
/** @var \MilanKyncl\Nette\SEO\SEOResolver @inject */
public $seo;
/** @var \MilanKyncl\Nette\SEO\Components\MetaTags @inject */
public $metaTagsComponent;
// Or in constructor:
public function __construct(\MilanKyncl\Nette\SEO\SEOResolver $seo, \MilanKyncl\Nette\SEO\Components\MetaTags $metaTagsComponent) {
$this->seo = $seo;
$this->metaTagsComponent = $metaTagsComponent;
}
// HomepagePresenter eg.
public function indexAction() {
$this->seo->setTitle('Homepage'); // The title will look like: Homepage - Super cool website! ({$title} {$separator} {$site_name})
}
// Base Presenter
public function createComponentSeoMetaTags() {
// You can use some methods to change default options from documentation here
// before returning the component
// $this->seo–>setTitle($title)
// $this->seo–>setDescription($description)
// $this->seo–>setImage($url, $width, $height)
// Use this right before returning the component
$this->metaTagsComponent->setResolver($this->seo);
return $this->metaTagsComponent;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.