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
-
How to handle blank, auto generated system pages/urls
Hi Guys Our backend system has been creating listing pages based on out of date and irrelevant data meaning we have hundreds of thousands of pages that are blank but currently indexable and active. They're almost impossible to access from the front end and have 0 traffic pointing at them but you can access these pages if you have the URL and i'm pretty sure due to the site architecture, google is crawling them regardless. For the most part, I think its likely best to 301 these pages to the most closely related page on the site but I'm concerned we're wasting crawl budget here. We don't want these pages to be crawled or found. Would a sound solution be to make them inactive, no-index and create a custom 404 in the event anyone (or the crawler) managed to get to them? Would this enormous increase in 404 pages cause us issues? Many thanks
Intermediate & Advanced SEO | | Jon.Kennett0 -
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 -
Should I be using meta robots tags on thank you pages with little content?
I'm working on a website with hundreds of thank you pages, does it make sense to no follow, no index these pages since there's little content on them? I'm thinking this should save me some crawl budget overall but is there any risk in cutting out the internal links found on the thank you pages? (These are only standard site-wide footer and navigation links.) Thanks!
Intermediate & Advanced SEO | | GSO0 -
Wordpress site, MOZ showing missing meta description but pages do not exist on backend
I've got a wordpress website (a client) and MOZ keeps showing missing meta descriptions. When I look at the pages these are nonsense pages, they do exist somewhere but I am not seeing them on the backend. Questions: 1) how do I fix this? Maybe it's a rel con issue? why is this referring to "non-sense" pages? When I go to the page there is nothing on it except maybe an image or the headline, it's very strange. Any input out there I greatly appreciate. Thank you
Intermediate & Advanced SEO | | SOM240 -
Ever had a case where publication of products & descriptions in ebay or amazon caused Panda penalty?
One of our shops got a Panda penalty back in september. We sell all our items with same product name and same product description also on amazon.com , amazon.co.uk, ebay.com and ebay.co.uk. Did you ever have a case where such multichannel sales caused panda penalty?
Intermediate & Advanced SEO | | lcourse0 -
Canonical Meta Tag
Can someone explain how this works and how necessary is it? For example, I have a new client, who is ranking WITHOUT the www in their domain, but they have a good deal of backlinks already that have www in it. When I set up google webmaster tools I made 2, one for WWW and one for WITHOUT and there are diffenet numbers of backlinks for each. I have no idea what do about this or if I should even do anything. Thanks
Intermediate & Advanced SEO | | TheGrid0 -
Blog not showing up when searching for exact post/META titles
I am working on a blog http://www.possessionista.com which is a very popular fashion blog. It is very well established with a 100% natural link profile and zero spammy stuff. The blog ranks #1 for random fashion terms like "kourtney kardashian cat eye sunglasses" and "emily maynard boots". The problem I am experiencing is that none of the actual titles of her posts or any of the content in the post results in her blog showing up if searched. EX: http://www.possessionista.com/2011/10/pippa-middletons-zip-jacket.html When you search "Pippa Middleton's Zip Jacket" on google her blog is nowhere to be found. Try searching allintitle:"Pippa Middleton's Zip Jacket" and she's nowhere to be found either. Even search "The other day, I met with my friend Kiran for our monthly mutual admiration society" on google and she's nowhere to be found even thoguh this is a unique snippet from her post. This post is already indexed and cached with the above mentioned details. i've also tested dozens of older posts as well. Same issue. You can actually do this to see a more clear picture: Do a google search for: allintitle:Bachelorette Fashion: Episode 2 - Ashley Hebert Brown site:possessionista.com That will bring up her blog which means google recognizes that the phrase is in her META title. Now do a google search for: allintitle:Bachelorette Fashion: Episode 2 - Ashley Hebert Brown without the site: included. She does not pop up but other people do. I did find that she had a duplicate title tag for a few weeks, but I've fixed that. Her posts used to pop up #1 when you search the title, but now obviously not. I am kind of at a loss and have tried a bunch of options with no success. Oh, one other thing is that some people do scrape her content, but only a few like maybe 10 and they've always been doing it even when she used to rank for her own post titles. Have you guys experienced this issue? Do you have any ideas of how to fix it?
Intermediate & Advanced SEO | | modparent0