Calotype\SEO\Generators\MetaGenerator::generate PHP Method

generate() public method

Render the meta tags.
public generate ( ) : string
return string
    public function generate()
    {
        $title = $this->getTitle();
        $description = $this->getDescription();
        $keywords = $this->getKeywords();
        $canonical = $this->getCanonical();
        $html[] = "<title>{$title}</title>";
        if (!empty($description)) {
            $html[] = "<meta name='description' content='{$description}' />";
        }
        if (!empty($keywords)) {
            $html[] = "<meta name='keywords' content='{$keywords}' />";
        }
        if (!empty($canonical)) {
            $html[] = "<link rel='canonical' href='{$canonical}' />";
        }
        return implode(PHP_EOL, $html);
    }