Elxis CMS Forum

Support => Elxis 4.x/5.x DEV => Topic started by: Luca on February 10, 2013, 17:12:36

Title: Robots Follow, Index or...
Post by: Luca on February 10, 2013, 17:12:36
Once again compliments for this Great new CMS, I am really impressed about it!

Anyway, wouldn't be interesting also having included in the Article/Page Parameters the option for robots to index/noindex/follow/nofollow (or combination of them)?

Just only my 1 cent...  :)

Thank you,

Luca
Title: Re: Robots Follow, Index or...
Post by: datahell on February 10, 2013, 23:06:56
Elxis puts noindex/nofollow automatically to pages they should not be indexed. All the rest pages should be indexed, so why to put such an option?
Title: Re: Robots Follow, Index or...
Post by: Luca on February 11, 2013, 00:29:49
@Datahell

Thank you for the answer.

 :) Yes.
i.e.
- in a contact page or in a long list of links I would set noindex/follow (ex., in another site (classifieds) I have set this in a page of 1000+ links to cities... ;
- in a "we are listed on..." page I would set noindex/nofollow or even index/nofollow...
and so on, depending on the use one would like to do..

IMO, would not be a wrong tool to have...  :)

Luca
Title: Re: Robots Follow, Index or...
Post by: datahell on February 11, 2013, 13:12:41
In Elxis 4.x you can set robots META tag by using the setMetaTag method of the elxisDocument (https://www.elxis.net/docs/developers/libraries/elxisdocument.html) library.

Example of setting robots to noindex, follow:

eFactory::getDocument()->setMetaTag('robots', 'noindex, follow', false);

One more tip
If you want to set these custom meta tags only on some articles you can put a check for the ELXIS_ARTID constant (article's id) inside your template's index.php file.

Example
if (defined('ELXIS_ARTID') && (ELXIS_ARTID == 3)) {
      eFactory::getDocument()->setMetaTag('robots', 'noindex, follow', false);
}

Example for multiple articles
if (defined('ELXIS_ARTID') && in_array(ELXIS_ARTID, array(3, 12, 7, 45, 28))) {
      eFactory::getDocument()->setMetaTag('robots', 'noindex, follow', false);
}

Note
In cases where a library is being used more than one time dont use the chained method but use it like that:
$eDoc = eFactory::getDocument();
$eDoc->setMetaTag(...);
$eDoc->setTitle(...);
$eDoc->addStyleLink(...);
Title: Re: Robots Follow, Index or...
Post by: Luca on February 11, 2013, 14:18:38
@Datahell

 :) Thank you!

luca
Title: Re: Robots Follow, Index or...
Post by: datahell on February 11, 2013, 18:45:53
A correction to me: The name of the Elxis constant that contains the current article's id is ELXIS_ARTID and not ARTID.