开发者

Adding custom meta

How can I add custom tags (for SEO) in Agile Toolkit (开发者_开发问答atk4)?


Like with any template, you can add additional text into it through something like this:

$object->add('Text')->set('...');

in your case you will be adding it into $api class.

http://codepad.agiletoolkit.org/metatags


I did this with the following steps on ATK 4.1.1

  1. Make a copy of /atk4/templates/shared/shared.html into /templates/default Always make a copy in our own website directory so we can still upgrade ATK later by overwriting the atk4 directory.
  2. Edited the shared.html you just created and add the following lines after the existing meta statement for Content-Type

    <meta name="description" content="<?metadesc?>Default description here<?/?> <meta name="keywords" content="<?metakeywords?>keyword, keyword, keyword...<?/?>

Now you will have your default description and keywords on all pages. 3. Finally, in /page/....php, put specific tags using the following lines

$p->api->template->set('page_title','page title goes here');
$p->api->template->set('metadesc','Page description goes here');
$p->api->template->set('metakeywords','keyword1','keyword2','keyword3');


There is a Seo-related controller as well:

https://github.com/atk4/atk4-addons/blob/master/misc/lib/Controller/Seo.php

You can use this by adding it into the API inside init();

$this->add('Controller_Seo');

Then it would simply copy certain tags from page's templates into section. The source should be simple enough to read through and understand the concept.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜