Moz Q&A is closed.
After more than 13 years, and tens of thousands of questions, Moz Q&A closed on 12th December 2024. Whilst we’re not completely removing the content - many posts will still be possible to view - we have locked both new posts and new replies. More details here.
How to auto generate a unique meta description?
-
The site I am working on is a code nightmare for starters. I'm editing a file called layout that controls the section of each page. The programmer from a while back got unique titles by putting this piece of code in:
<title><?= $this->metaTag ?></title>
In all the different controllers and stuff I can see where the title is the name of the product plus review or something to that effect.
How do I do this for the meta description? Right now the meta description is static in the layout file, and so every page has an identical one. I was hoping there was a way to make the meta description automatically use the first 140 characters on the page or something. Something like this:
-
Perfect!
Glad to hear it's all fixed
-
This worked like a charm! The site is on something called Zend cart I think and I had to sort through several Controllers but eventually found all the metaTag stuff in there and added a metaDesc variable next to them, unique meta descriptions on every page! Thanks!
-
Hi Daniel,
The first thing you need to do is to find the definition of the container that “this” is built out of and then add an element called metaDescription.
This will create an empty string until you populate it elsewhere.
Now where you want metaDescription shown, you just use
<title><?= $this->metaDescription ?></title> (replace metaTag with metaDescription).
Next, you need to search your code for the place where metaTag is assigned and add an assignment for metaDescription which can be whatever you want it to be ie a substring etc.
Hope that helps,
Sha
-
I just did a large 5k page website with the same kind of auto generation, It worked very well. I'm not sure how your website is setup and if the content is all on the database but ours is and we just had to fill in some variables like this.
<title><?=ucfirst($ctar[county_name]);?> Jail, <?=$star[state_name];?> | Bail Bonds & Lawyer Resources</title>
Most likely you are looking for something like strip tags.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
What to do with sold product pages when everything you sell are unique one off items
Hi there, This is something i have been unsure of for years. It's a little different to most ecom website situations. What would you do with product pages when every product is a "one off" unique product and once sold will never be for sale again? Should i redirect to a category page? 404? Leave it as is marked as sold or say it is sold and show links to similar items? At the moment we have 700 products for sale but over 5000 sold products that have their own product page and my concern is as this grows it could become a lot for a WordPress woocommerce site to handle? I don't want to do anything to slow my site down or unnecessarily bloat it but i want to do the right thing by the visitor and also not do anything to hurt my rankings. These pages often rank in google and may have been there for years before the item actually sells. To throw another curve ball, there may be multiple other products (for sale or already sold) with the exact same name but are unique and different from each other. These products pages will often be 98% the same content as each other too. To explain how this could be the case, we sell artworks from many different artists, Every artwork is an original and is unique. But many artists paint the same subject matter multiple times, albeit in a slightly different way from previous times. So you end up with a unique product that has everything the same as another (same artist, same name of artwork, same size, same description, different image, different sku) but is actually different and unique. This has left me somewhat uncertain of what is best to do. Any advice would be greatly appreciated. Thank you
Intermediate & Advanced SEO | | Scottlinklater0 -
How does product category description affect SEO?
Hi - we are a website that sells tours. We have category pages that list the tours in that category (by city, by length of time, theme, etc). At the top of each category page, before the buttons linking to the tours, there is a category description. It is a pretty long paragraph. We are redesigning the website and think it would look nicer to show 2-3 lines of text and then have a down arrow and 'read' more so people can click and it would expand to show the full category description if they want to read it and it won't take up so much room that way. My question is - will this affect SEA at all? Or because the text is still there, just hidden, it won't do anything? Our site ranks very high in organic searches on google and we do not want to do anything that will hurt SEO. thanks.
Intermediate & Advanced SEO | | Shirapn0 -
Are rel=author and rel=publisher meta tags currently in use?
Hello, Do these meta tags have any current usage? <meta name="author" content="Author Name"><meta name="publisher" content="Publisher Name"> I have also seen this usage linking to a companies Google+ Page:Thank you
Intermediate & Advanced SEO | | srbello0 -
How do Yelp and Justia get all the extra Meta Description Real estate?
I was doing some KW research for a client and noticed something interesting with regard to Yelp and Justia. For a search on DWI Attorneys, they each had over 300 character meta descriptions showing on the SERP without truncating. Everyone else was either truncated or within limit of roughly 160 characters. Obviously if there is a way to get something other than a list to show that way you can own some real estate. Would love to hear from some of you Mozzers on this. Here are two images that should assist. Best Edit: I found one that was not a directory site and it appears it is Google doing it. The site has no meta description for the home page and this is what is being pulled by Google. There are 327 characters here! The truncation marks are showing it being pulled from different parts of the page. Image is Killeen DWI Attorney. NOTE None of these are clients, etc. I also changed the cities so this is a general search. zAQpA qZ9KI 06p7U
Intermediate & Advanced SEO | | RobertFisher1 -
Wrong meta descriptions showing in the SERPS
We recently launched a new site on https, and I'm seeing a few errors in the SERPS with our meta descriptions as our pages are starting to get indexed. We have the correct meta data in our code but it's being output in Google differently. Example: http://imgur.com/ybqxmqg Is this just a glitch on Google's side or is there an obvious issue anyone sees that I'm missing? Thanks guys!
Intermediate & Advanced SEO | | Brian_Owens_10 -
Ecommerce Site - Duplicate product descriptions & SKU pages
Hi I have a couple of questions regarding the best way to optimise SKU pages on a large ecommerce site. At the moment we have 2 landing pages per product - one is the primary landing page with no SKU, the other includes the SKU in the URL so our sales people & customers can find it when using the search facility on the site. The SKU landing page has a canonical pointing to the primary page as they're duplicates. Is this the best way? Or is it better to have the one page with the SKU in the URL? Also, we have loads of products with the very similar product descriptions, I am working on trying to include a unique paragraph or few sentences on these to improve the content - how dangerous is the duplicate content within your own site? I know its best to have totally unique content, but it won't be possible on a site with thousands of products and a small team. At the moment I am trying to prioritise the products to update. Thank you 🙂
Intermediate & Advanced SEO | | BeckyKey0 -
Should I noindex the site search page? It is generating 4% of my organic traffic.
I read about some recommendations to noindex the URL of the site search.
Intermediate & Advanced SEO | | lcourse
Checked in analytics that site search URL generated about 4% of my total organic search traffic (<2% of sales). My reasoning is that site search may generate duplicated content issues and may prevent the more relevant product or category pages from showing up instead. Would you noindex this page or not? Any thoughts?0 -
Meta Keywords: Should we use them or not?
I am working through our site and see that meta keywords are being used heavily and unnecessarily. Each of our info pages will have 2 or 3 keyword phrases built into them. Should we just duplicate the keyword phrases into the meta keyword field, should put in additional keywords beyond or not use it at all? Thoughts and opinions appreciated
Intermediate & Advanced SEO | | Towelsrus1