geniv/nette-seo

Seo extension for Nette Framework

v2.2.8 2019-01-17 23:58 UTC

README

description: block title and description are automatic internal save to database

Installation

$ composer require geniv/nette-seo

or

"geniv/nette-seo": "^2.0"

require:

"php": ">=7.0",
"nette/nette": ">=2.4",
"dibi/dibi": ">=3.0",
"geniv/nette-locale": ">=2.0"

Include in application

Storage: (dibi + cache _Seo-Seo)

enabled: false => stop loading from database and skip load data

neon configure:

# seo
seo:
#   autowired: true
    tablePrefix: %tablePrefix%
#   enabled: true

neon configure extension:

extensions:
    seo: Seo\Bridges\Nette\Extension

usage:

protected function createComponentSeo(ISeo $seo): ISeo
{
    //$seo->setAutoCreate(true);
    return $seo;
}
{control seo:title}
{control seo:title, null, 'default'}
{control seo:description}
{control seo:description, null, 'default'}
{control seo:title 'default-latte'}
{control seo:title 'default-latte', 'default'}
{control seo:description 'default-latte'}
{control seo:description 'default-latte', 'default'}
return usage: {control seo:description 'default-latte'}
{if $presenter['seo']->isTitle()} ... {/if}
{if $presenter['seo']->isTitle('ident')} ... {/if}
{if $presenter['seo']->getTitle()} ... {/if}
{if $presenter['seo']->getTitle('ident')} ... {/if}
{if $presenter['seo']->getTitle('ident', 'default')} ... {/if}
{if $presenter['seo']->isDescription()} ... {/if}
{if $presenter['seo']->isDescription('ident')} ... {/if}
{if $presenter['seo']->gerDescription()} ... {/if}
{if $presenter['seo']->gerDescription('ident')} ... {/if}
{if $presenter['seo']->gerDescription('ident', 'default')} ... {/if}

usage @layout.latte:

<title>{ifset title}{include title} - {else}{control seo:title}{if $presenter['seo']->isTitle()} - {/if}{/ifset}{control seo:title 'default-latte'}</title>
<meta name="description" content="{ifset description}{include description} - {else}{control seo:description}{if $presenter['seo']->isDescription()} - {/if}{/ifset}{control seo:description 'default-latte'}">

Warning:

text ident in title and description is automatic translate!!!

{block title}homepage-title{/block}
{block description}homepage-description{/block}

in case usage block: {block title} or {block description} content this block does not save to database!!!