Documentation

Light-weight, fast, simple and powerful!
 
Translations of this page?:

Set Metadata per-page

Each page can have its own <meta name=“description” ...> and <meta name=“keywords”...> fields in the <head> section of the document. This is very useful for those interested in SEO issues.

When editing a page, the tab beside the “Page Title” tab is called “Metadata”. Click on it, and you find fields for “Keywords” and a slightly larger text box for “Description”. Fill the page-specific details here.

Using the Metadata

The simplest code to use in <head> … </head> section of your document (usually in the Layout for your site) is:

  <meta name="keywords" content="<?php echo $this->keywords(); ?>" />
  <meta name="description" content="<?php echo $this->description(); ?>" />

This assumes you always use the Metadata fields for every page in your site. If you want to use some standard wording but just vary it occasionally, then use the following:

  <meta name="keywords" content="<?php if ($this->keywords() != '') {
    echo $this->keywords(); }
      else {
    echo 'default, keywords, here'; } ?>" />
  <meta name="description" content="<?php if ($this->description() != '') {
    echo $this->description(); }
      else {
    echo 'Default description goes here'; } ?>" />

This checks to see if there is any Metadata filled in for the page, and if there is, it is used. Otherwise, the default text is used.

The default Layouts that come with Wolf “out-of-the-box” have the “default or variation” code (the second example, above) already included.

 
howto/set_metadata_per-page.txt · Last modified: 2011-09-12 00:46 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license:GNU Free Documentation License 1.2
Copyright 2010 wolfcms.org / design by yello studio / Wolf CMS Inside