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 ToolsChat with the community about the Moz tools. 
- 
		
		SEO TacticsDiscuss the SEO process with fellow marketers 
- 
		
		CommunityDiscuss industry events, jobs, and news! 
- 
		
		Digital MarketingChat about tactics outside of SEO 
- 
		
		Research & TrendsDive into research and trends in the search industry. 
- 
		
		SupportConnect on product support and feature requests. 
Related Questions
- 
		
		
		
		
		
		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
- 
		
		
		
		
		
		How does Infinite Scrolling work with unique URLS as users scroll down? And is this SEO friendly?
 I was on a site today and as i scrolled down and viewed the other posts that were below the top one i read, i noticed that each post below the top one had its own unique URL. I have not seen this and was curious if this method of infinite scrolling is SEO friendly. Will Google's spiders scroll down and index these posts below the top one and index them? The URLs of these lower posts by the way were the same URLs that would be seen if i clicked on each of these posts. Looking at Google's preferred method for Infinite scrolling they recommend something different - https://webmasters.googleblog.com/2014/02/infinite-scroll-search-friendly.html . Welcome all insight. Thanks! Christian Intermediate & Advanced SEO | | Sundance_Kidd0
- 
		
		
		
		
		
		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
- 
		
		
		
		
		
		Should I remove Meta Keywords tags?
 Hi, Do you recommend removing Meta Keywords or is there "nothing to lose" with having them? Thanks Intermediate & Advanced SEO | | BeytzNet0
- 
		
		
		
		
		
		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
- 
		
		
		
		
		
		Meta Tag Force Page Refresh - Good or Bad?
 I had recently come across a meta tag that could cause a auto refresh on a users browser when implemented. I have been using it for a redesign and was curious if there could be any negative effects for using it, here is the code: All input is appreciated. Ciao, Todd Richard Intermediate & Advanced SEO | | RichFinnSEO0
- 
		
		
		
		
		
		Does Google crawl the pages which are generated via the site's search box queries?
 For example, if I search for an 'x' item in a site's search box and if the site displays a list of results based on the query, would that page be crawled? I am asking this question because this would be a URL that is non existent on the site and hence am confused as to whether Google bots would be able to find it. Intermediate & Advanced SEO | | pulseseo0
 
			
		 
			
		 
			
		 
					
				 
					
				 
					
				 
					
				 
					
				 
					
				 
					
				