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
-
Site moved. Unable to index page : Noindex detected in robots meta tag?!
Hope someone can shed some light on this: We moved our smaller site (into the main site ( different domains) . The smaller site that was moved ( https://www.bluegreenrentals.com)
Intermediate & Advanced SEO | | bgvsiteadmin
Directory where the site was moved (https://www.bluegreenvacations.com/rentals) Each page from the old site was 301 redirected to the appropriate page under .com/rentals. But we are seeing a significant drop in rankings and traffic., as I am unable to request a change of address in Google search console (a separate issue that I can elaborate on). Lots of (301 redirect) new destination pages are not indexed. When Inspected, I got a message : Indexing allowed? No: 'index' detected in 'robots' meta tagAll pages are set as Index/follow and there are no restrictions in robots.txtHere is an example URL :https://www.bluegreenvacations.com/rentals/resorts/colorado/innsbruck-aspen/Can someone take a look and share an opinion on this issue?Thank you!0 -
Does Google ignore duplicate meta descriptions?
Hi there SEO mozzers, I am dealing with a website that has duplicate meta descriptions (we know is bad).As a punishment, Google totally ignores the meta descriptions and picks content from the website and displays it in SERP. I already read the https://moz.com/blog/why-wont-google-use-my-meta-description but I was wondering if there is more information/knowledge out there. Any tips are appreciated!
Intermediate & Advanced SEO | | Europarl_SEO_Team0 -
Google overriding meta description - retrospective?
Hi all, we run a furniture store and our results in Google.co.uk almost always use the page's content as the description in the search results, even though we have a correctly implemented meta description tag. The rival's pages that rank above and below us almost always show the ranking page's meta description in Google's results page. Our developer seems to think it's because we added the meta description tags long after the pages were first indexed by Google and he seems to think Google has "fixed" on the page content and is happy with that over our meta description ...but I've never heard of that before. Thank you.
Intermediate & Advanced SEO | | Bee1590 -
Constructing the perfect META Title - Ranking vs CTR vs Search Volume
Hello Mozzers! I want to discuss the science behind the perfect META Title in terms of three factors: 1. Ranking 2. CTR 3. Search Volume Hypothetical scenario: A furniture company "Boogie Beds" wants to optimise their META Title tag for their "Cane Beds" ecommerce webpage. 1. The keywords "Cane Beds' has a search volume of 10,000 2. The keywords " Cane Beds For Sale" has a search volume of 250 3. The keywords "Buy Cane Beds" has a search volume of 25 One of Boogie Beds SEO's suggests a META Title "Buy Cane Beds For Sale Online | Boogie Beds" to target and rank for all three keywords and capture long tail searches. The other Boogie Bed SEO says no! The META Title should be "Cane Beds For Sale | Boogie Beds" to target the most important two competitive keywords and sacrifice the "Buy" keyword for the other two Which SEO would you agree more with, considering 1. Ranking ability 2. Click through rates 3. Long tail search volume 4. Keyword dilution Much appreciated! MozAddict
Intermediate & Advanced SEO | | MozAddict1 -
Best server-side sitemap generators
I've been looking into sitemap generators recently and have got a good knowledge of what creating a sitemap for a small website of below 500 URLs involves. I have successfully generated a sitemap for a very small site, but I’m trying to work out the best way of crawling a large site with millions of URLs. I’ve decided that the best way to crawl such a large number of URLs is to use a server side sitemap, but this is an area that doesn’t seem to be covered in detail on SEO blogs / forums. Could anyone recommend a good server side sitemap generator? What do you think of the automated offerings from Google and Bing? I’ve found a list of server side sitemap generators from Google, but I can’t see any way to choose between them. I realise that a lot will depend on the type of technologies we use server side, but I'm afraid that I don't know them at this time.
Intermediate & Advanced SEO | | RG_SEO0 -
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 -
Image ALT Descriptions
Due to the way our system is and the way we want to do something. We have to make the description for each image in the ALT. Now this is not just a few words but is actually a few sentences. Is there going to be any negative disadvantage to doing it this way? The positives I see is that it will help with accessibility and atleast the bots will be able to tell what the item is about. The negatives is that maybe this description could be better used elsewhere?
Intermediate & Advanced SEO | | websitesaleslab0 -
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