<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>META Tag Archives - gj</title>
	<atom:link href="https://blog.gaiterjones.com/tag/meta-tag/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.gaiterjones.com/tag/meta-tag/</link>
	<description>gaiterjones</description>
	<lastBuildDate>Fri, 25 Feb 2011 15:59:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>
	<item>
		<title>Magento SEO &#8211; Generate META Description Tags Automatically</title>
		<link>https://blog.gaiterjones.com/magento-seo-generate-meta-description-tags-automatically/</link>
					<comments>https://blog.gaiterjones.com/magento-seo-generate-meta-description-tags-automatically/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Mon, 10 Jan 2011 17:04:57 +0000</pubDate>
				<category><![CDATA[Magento]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[META Tag]]></category>
		<category><![CDATA[Product Description]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=46</guid>

					<description><![CDATA[Whilst some may argue that the META description tag has little SEO value, it is used by search engines to compile page &#8220;snippets&#8221; that are displayed next to the search...<a class="more-link" href="https://blog.gaiterjones.com/magento-seo-generate-meta-description-tags-automatically/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p>Whilst some may argue that the META description tag has little SEO value, it is used by search engines to compile page &#8220;snippets&#8221; that are displayed next to the search results, and these snippets should contain meaningful and good SEO content. When you add a new product in Magento you need to think about your SEO keywords, page title and META tag content. If you have a lot of products and have not created META description tag content for them then it can be a lot of work to update all the products maually, and more work to keep them up to date. There are a couple of ways to make this easier, you can export all your products, and edit the META description for each product and then reimport them into Magento which is a very slow process, or you can automatically create the META description based on your products long description, your products should at least have good descriptions!</p>
<p>Product descriptions in our Magento shop usually contain the product name in bold type on the first line, followed by a few good SEO keyword rich product description sentences. We can use this product description to create a nice META description tag with just a few lines of code in the head.phtml template file of your theme.</p>
<p>For example, if we look at the sample database products, the Nokia 2610 product description looks like this</p>
<figure id="attachment_49" aria-describedby="caption-attachment-49" style="width: 519px" class="wp-caption alignnone"><a href="https://blog.gaiterjones.com/wp-content/uploads/2011/01/magento-seo-description-meta-tag-2610-product2.jpg"><img fetchpriority="high" decoding="async" class="hang-1-column    " style="border: 1px solid black;" title="Automatic product description META tags in Magento" src="https://blog.gaiterjones.com/wp-content/uploads/2011/01/magento-seo-description-meta-tag-2610-product2.jpg" alt="" width="519" height="231" /></a><figcaption id="caption-attachment-49" class="wp-caption-text">Sample database product description</figcaption></figure>
<p>The description META tag from the sample database for this product looks like this &#8220;<em><strong>Offering advanced media and calling features without breaking the bank, The Nokia 2610 is an easy to use</strong></em>&#8221;</p>
<p>How about we use the product name and the first sentence from the description as the product description META tag for all our products? This can easily be accomplished by replacing the META description tag code in <strong>head.phtml </strong>located in your themes <em>template/page/html/</em> folder.</p>
<p>Replace:</p>
<pre class="brush:applescript">&lt;meta name="description" content="&lt;?php echo htmlspecialchars($this-&gt;getDescription()) ?&gt;" /&gt;</pre>
<p>With:</p>
<pre class="brush:php">&lt;?php if (Mage::registry('current_product')) : ?&gt;
&lt;?php if (strip_tags(str_replace("&lt;br /&gt;",", ",substr(Mage::registry('current_product')-&gt;getDescription(), 0, strpos(Mage::registry('current_product')-&gt;getDescription(), '.')+1)))=="") : ?&gt;
&lt;?php echo '&lt;meta name="description" content="'.htmlspecialchars($this-&gt;getDescription()).'" /&gt;' ?&gt;
&lt;?php else: ?&gt;
&lt;?php echo '&lt;meta name="description" content="'.strip_tags(str_replace("&lt;br /&gt;",", ",substr(Mage::registry('current_product')-&gt;getDescription(), 0, strpos(Mage::registry('current_product')-&gt;getDescription(), '.')+1))).'" /&gt;' ?&gt;
&lt;?php endif; ?&gt;
&lt;?php else: ?&gt;
&lt;?php echo '&lt;meta name="description" content="'.htmlspecialchars($this-&gt;getDescription()).'" /&gt;' ?&gt;
&lt;?php endif; ?&gt;</pre>
<p>This code will first check that we are working with a product page, it then takes the long product description text, replaces the first html line break with a comma, extracts the text to the first full stop and then strips out any markup tags. If the resulting description is empty then we revert to using the normal product META description.</p>
<p>The resulting slightly better looking META description tag for our product now looks like this <em>&#8220;<strong>Nokia 2610 Phone, The Nokia 2610 is an easy to use device that combines multiple messaging options including email, instant messaging, and more.</strong>&#8221; </em>Google will use this as the description snippet in search results. I use this same text for my <a href="https://blog.gaiterjones.com/automatic-magento-product-marketing-tweets-for-twitter/">automated product marketing tweets</a> and Facebook content too &#8211; more on that later.</p>
<p><strong>All </strong>our products should now have nicely formatted META description tags.  Play around with the str_replace function to extract the text you want from your product descriptions,  make sure you have your main SEO keywords in both the first sentence of your product description and your HTML Title and you are now on your way to better SEO content for all your products, and good looking content for your search engine description snippets.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/magento-seo-generate-meta-description-tags-automatically/feed/</wfw:commentRss>
			<slash:comments>24</slash:comments>
		
		
			</item>
	</channel>
</rss>
