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.
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 about new meta description character limit?
Hey Everyone, So as I'm sure everyone has heard the new meta description limits have been increased and I have been going back and forth with whether or not to update my descriptions for my client's websites. I know that Google is now dynamically generating descriptions based off of content, but is it still beneficial to write longer descriptions as well? Will Google display my longer description now if it is ranking well? Rand Fishkin at Moz and others say that you should and other people, including Danny Sullivan, have said you shouldn't worry about it and leave them at between 150-160. My questions is what should I do? I will be focusing heavily on making sure the site's content is very targeted and relevant for when Google dynamically generates the descriptions, but should I still edit my descriptions manually?
Intermediate & Advanced SEO | | kenturley2 -
Tools to test meta descriptions?
Hey does anyone know of any tools which can test your meta descriptions against competitors meta descriptions for specific keyword terms. I know one tool called SERP Turkey which uses mechanical turk, i was wondering if there is any others on the market? Even a tool which can automatically score your meta description against others on the SERP results page. E..g optimised, keyword, call to action, etc. Cheers, Chris
Intermediate & Advanced SEO | | jayoliverwright0 -
Using unique content from "rel=canonical"ized page
Hey everyone, I have a question about the following scenario: Page 1: Text A, Text B, Text C Page 2 (rel=canonical to Page 1): Text A, Text B, Text C, Text D Much of the content on page 2 is "rel=canonical"ized to page 1 to signalize duplicate content. However, Page 2 also contains some unique text not found in Page 1. How safe is it to use the unique content from Page 2 on a new page (Page 3) if the intention is to rank Page 3? Does that make any sense? 🙂
Intermediate & Advanced SEO | | ipancake0 -
Google and Product Description Tabs
How does Google process a product page with description tabs? For example, lets say the product page has a tab for Overview, Specifications, What's In the Box and so on. Wouldn't that content be better served in one main product description tab with the tab names used as (htags) or highlighted paragraph separators? Or, does all that content get crawled as a single page regardless of the tabs?
Intermediate & Advanced SEO | | AWCthreads0 -
Need to shorten and change site-wide meta titles (50.000 pages). OK to do all at once?
Just noticed that google completely screws up our meta titles in the SERPs. Google decided to show titles which are not understandable to visitors and worst of all even shows titles in different languages than the actual page. The words of the displayedf titles are nowhere on the page (actually they are parts of old title tags that we stopped using 6 months ago and that we used on different pages). Pages are crawled weekly. All our meta titles are a bit longer than the 70 character limit, so I plan to rephrase and shorten them so that they are all max. 66 characters. Dynamically we choose different variations of title texts based on character length of keywords. Having titles that fit into SERPs without cutting are supposed to have less probability to be changed by google. I heard some people reporting loss of rankings after site-wide meta title changes. Especially since we changed title tags sitewide already about 6 months ago I am a bit concerned. How would you proceed? Just do the site-wide change all at once?
Intermediate & Advanced SEO | | lcourse0 -
Links from a website or a subdomain, which would generate more benefits in terms of SEO?
I have a customer who just bought a domain (and the full website) of a competitor and decided that they will no longer update the website purchased. The website of my client has a Domain Authority = 50 and DA of the website purchased is 45. Each of them was registered by different companies and are on different servers too.
Intermediate & Advanced SEO | | marciofelias
The reason for my message is that by being registered by different companies and are in differrent servers I can use the site purchased as a way to make link building to the main website (one way link buiding only from the website purchased to the main website), but I can put the website purchased as a subdomain of the main website and agregate content to the main website.
In your opinion which would generate more benefits in terms of SEO to the main website? Links from the website purchased or put this website as a subdomain to the main website?0 -
Faceted navigation, Affiliate links, Meta descriptions - Oh My!
Hi, I have recently come across an issue with the faceted navigation / dynamic URLs for one of my client sites: From a top level category you can filter by product material, size, type and colour. The URLs which are generated go a little something like this: www.domainname.co.uk/category.aspx?finish=leather&colour=--+no+filter+-- When selected, a 'facet' 302 redirects from the main category URL (no canonical tags in place yet - working on it). The 'facets' are indexed (although when clicked on from SERPs actually go to a slightly different URL than by navigating there from the site) but they don't display the Meta description in SERPs (instead displaying a list of items from a drop down menu held within a table - probably as it's the first bit of copy the search engines see on the page). How can I get the Meta description to display in SERPs? Also, I tried to add a link to a 'facet' from my blog (just for testing purposes) and I got redirected to the page via their affiliate program. Ideally I want to 'link build' to these pages both internally and via the clients blog but it seems as though there'll be no value in it. Has anyone come across this before and if so, what can I do about it? FYI they are using IIS 6 with asp.net Thanks in advance!
Intermediate & Advanced SEO | | WalkerM0 -
Meta Revisit?
Hi there, We have just migrated to a new website with a new design etc and I have noticed that we now have this code on our website: From my understanding this is telling search engines to come back to your website in 10 days time to crawl the website? I'm sure I have read on serveral occasions that you should not does this and let search engines crawl your site when it see's fit to do so? Hope someone can help me out on this Kind Regards,
Intermediate & Advanced SEO | | Paul780