META tags

From MODx Wiki

Jump to: navigation, search

Contents

Short FAQ

Do I need to use a special TV in my template to use the default MODx META-Tag/Keyword feature?
No. The default META-Tag feature is independent of the template engine, and if you have manually added META aliases in your templates/chunks they may be duplicated. So please check first that a META alias is used only once in the manager or in your template.
Is this feature activated by default?
No. You can manage META stuff completly in your templates/chunks if your prefer with no inteference with the default MODx installed META-Tags. If you want to activate it you have to do it per/page basis.

How to add a META-Tag/Keyword

  1. Log into the manager, and go to Resources --> Manage META-Tag and Keywords.
  2. Add/remove or change the default META/keywords on the page.
  3. Go to the page that you would like to activate the META/keywords on (ie. your "Home" page).
  4. Click on "Edit" and on "META Keywords".
  5. Click on the META and keywords that you want to activate for the page. You can ctrl-click on multiple keywords to activate more than one.
  6. Click on the "Save" button at the top of the page.
  7. Preview the page and check the source of the page to make sure everything has gone well (in FF it's Ctrl+U, and in IE it's View --> Source).

Note: The META feature is used on a per-page basis, which may not be very convenient to use them on a huge site. See below a workaround for this.

Template Workaround

Here is a template trick that you can use as a workaround to modify your META tags using QuickEdit, without the use of the manager.

1. The "Description" META tag - Add the following code into your template in the <head> section:

<meta name="description" content="[*description*]" />

2. The "Keywords" META tag:

<meta name="keywords" content="[*introtext*]" />

3. A META Chunk - You could also create a Chunk specifically for all of your META tags (so you could put your description, keywords, author, etc tags into one chunk). So create a new Chunk and name it whatever you'd like (for the sake of example we'll call it "META_Tag_Chunk". Inside that, you'll put all of your META tags. For example:

<meta name="keywords" content="keyword1, keyword2, keyword3, keyword4, keyword5" />
<meta name="description" content="[*description*]" />

And in the <head> section of your template, place a call to the Chunk you created:

{{META_Tag_chunk}}

Other Methods

With MODx, there is almost always more than one way to accomplish the same task. For example, you have a big website with reviews of hi-tech products, so you have some categories (folders) such as:

  • Web design
  • Software
  • CMS
  • Apple
  • Microsoft
  • ...

Using META tag List Menu

In the latest 0.9.5 branch of MODx we have added "keywords" in the tag list menu too, so you can quickly create several groups of keywords (ie. "software_keywords", "web_design_keywords", "CMS_keywords", etc) and apply using the manager page settings.

Using @INHERIT in a TV (template variable)

  • Create a TV called "keywords" with the default value "@INHERIT".
  • Add "<meta name="keywords" content="[*keywords*]" />" to your template.
  • c. Put your favorite keywords in the TV "keywords" ONLY in the home category page (ie. www.yoursite.com/webdesign.html) and leave the default value @INHERIT for all the article pages inside the categories.
Personal tools