META tags

by Copper - Member - 06:49PM, Apr 19, 2007

How would I go about making separate META tags and page titles for each page? I’m getting the same tags on every page.

Thanks.

danW

Shopify Advisor

07:15PM, Apr 19, 2007

in theme.liquid you should have something like this.

 <title>{{ shop.name }} - {{ page_title }}</title>

For dynamic meta tags, that would require something like maybe cases.


{% case 'page_title' %}

{% when 'Welcome' %}
 <meta name="description" content="Description here"/>
 <meta name="keywords" content="Keywords here" />

{% when 'Product-Foo' %}
 <meta name="description" content="{{ product.description }}"/>
 <meta name="keywords" content="keywords here">

{% endcase %}

Copper

Member

09:14PM, Apr 19, 2007

Thanks Dan.

Where would the dynamic code go? What’s a “Product-Foo”?

danW

Shopify Advisor

07:24PM, Apr 20, 2007

Should go in the head section of the theme.liquid file.

Product-Foo is just a name I came up with to illustrate the title of product page.

Copper

Member

09:54PM, Apr 20, 2007

Gotcha – Thanks Dan!

Mick Mac

Member

02:06AM, May 26, 2007

Hi Dan, Yesterday I came across a website, whois.domaintools.com , it gives you information about your domain. In the section for “front page information” , under “Meta Relevance” it said “No terms. Site needs Meta Description.” I had a look in my admin, in Theme.Liquid, but was not sure what to look for. What would a Meta Description look like ? And where is it usually placed ? Thanks a lot, Mickmac

danW

Shopify Advisor

04:00AM, May 26, 2007

Hi Mickmac,

The meta tags would go inbetween the <head> </head> tags usually right under the title tags.

The meta description is usually a text string that gives a description of the site. It would look like this.

 <meta name="description" content="Description goes here" />

Mick Mac

Member

06:36AM, May 26, 2007

Thanks Dan, You were right, it was there between the <head> </head> tags. I wonder why that report on my site said ” No terms.Site needs Meta Description” ? What would happen if I added another one, would that cause problems ? Mickmac

dan

Member

12:52PM, Jul 14, 2007

I have a couple of problems with this approach.

1. I use HTML in my description…or I guess textile is putting formatted text into the db for my description, so when I use {{ product.description }} in the meta, I get broken html and some browsers dont render correctly.

So how do I de-textile-ify my description so I can use it in the meta?

B. I thought it was natural to use my {{ product.tags }} in the keywords meta, but they come out as a single string.

How do I generate a comma delimited list from {{ product.tags }}?

tia,
dan

dan

Member

02:48AM, Jul 18, 2007

bump

tobi

Shopify

02:57AM, Jul 18, 2007

You can try {{ product.tags | join: ' ' }} or use {{ product.description | strip_tags }} to get rid of the html tags of the description

---

Tobias Lütke
Shopify – Founder, CEO

dan

Member

08:01AM, Jul 22, 2007

Thanks, thats great. The join works perfectly, however strip_tags does not seem to be stripping.

See this:
http://www.pavitracreations.com/collections/all/products/white-cotton-silver-stripe-top

as an example.

The last part of the description is showing at the top of the page, and if you view source, you’ll see all of the html in the meta.

Thanks again…
dan

You must login to post a comment!

Don't have an account yet? Sign up for one.