Skip to main content

Introduction

This tutorial shows how to use Velocity code on your catalog header to dynamically display your meta tags. This velocity code example is intended to be used on the Catalog:

note

Main MenuCatalog → Choose the host → Manage Catalog Templates

Sample Code

<meta name="author" content="group.getAttributeValueEditable("meta-author")" />
<meta name="keywords" content="$group.getAttributeValueEditable("meta-keywords")" />
<meta name="description" content="$group.getAttributeValueEditable("meta-description")" />

Break Down

We are really using the same code ( group.getAttributeValueEditable("") ) over and over but pulling different information based on the attribute being called.

<meta name="author" content="group.getAttributeValueEditable("meta-author")" />

For example here we are using our code group.getAttributeValueEditable("meta-author") to pull the attribute for meta-author to display that content. For example our output would look something like this:

<meta name="author" content="UltraCart" />

What this allow us to do is dynamically pull content based on the group page the customer is looking at. So rather then having 10 group pages and having to make changes to them, with the catalog you can create this as one page and pull the information from attributes of the groups themselves. This is true for just about anything not just meta tag information.

Was this page helpful?