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
-
Cleaning up user generated nofollow broken links in content.
We have a question/answer section on our website, so it's user generated content. We've programmed all user generated links to be nofollow. Over time... we now have many broken links and some are even structurally invalid. Ex. 'http:///.'. I'm wanting to go in and clean up the links to improve user experience, but how do I justify it from an SEO standpoint and is it worth it?
Intermediate & Advanced SEO | | mysitesrock0 -
Webmaster is giving errors of Duplicate Meta Descriptions and Duplicate Title Tags
Webmaster is giving errors of Duplicate Meta Descriptions and Duplicate Title Tags after I changes the permalinks structure in wordpress. It there a quick fix for this and how damaging is the above for seo. Thanks T
Intermediate & Advanced SEO | | Taiger0 -
Any Good XML Sitemaps Generator?
I was wondering if everyone could recommend what XML Sitemap generators they use. I've been using XML-Sitemap, and it's been a little hit and miss for me. Some sites it works great, other it really has serious problems indexing pages. I've also uses Google's, but unfortunately it's not very flexible to use. Any recommendation would be much appreciated.
Intermediate & Advanced SEO | | alrockn0 -
Canonical tag - but Title and Description are slightly different
I am building a new SEO site with a "Silo" / Themed architecture. I have a travel website selling hotel reservations. I list a hotel page under a city page - example, www.abc.com/Dallas/Hilton.html Then I use that same property under a segment within the city - example www.abc.com/Dallas/Downtown/Hilton.html, so there are two URLs with the same content Both pages are identical, except I want to customize the Title and Description. I want to customize the title and description to build a consistent theme - for example the /Downtown/Hilton page will have the words "Near Downtown" in the Title and Description, while the primary city Hilton page will not. So I have two questions about this. First, is it okay to use a canonical tag if the Title and Description are slightly different? Everything else is identical. If so, will Google crawl and comprehend the unique Title and Description on the "Downtown" silo? I want Google to see that I have several "supporting" pages to my main landing page(s). I want to present to Google 5 supporting pages in each silo that each has a supporting keyword theme. But I'm not sure if Google will consider content of pages that point to a different page using the canonical tag. Please see this supporting example: http://d.pr/i/aQPv Thanks for your insights. Rob
Intermediate & Advanced SEO | | partnerf0 -
Are breadcrumbs any good and Should I insert links on the Item descriptions and specs?
Hi All, In my e-commerce site in each product page I have the breadcrumbs on top which show the root categories that lead to this product. However, I saw once that Google even if you use several anchors from page A to page B Google treats only/mainly the first anchor. This means that inserting contextual links on the product text, the product description, that leads to the category page (which is an important landing page) is irrelevant/ambiguous since the link is already in the breadcrumb on top. What do you think? Should I insert contextual links on the item description or is it worthless? Thanks
Intermediate & Advanced SEO | | BeytzNet0 -
Which is more effective: JQuery + CSS for Tabbed Content or Create Unique Pages for each tab.
We are building a from-scratch directory site and trying to determine the best way to structure our pages. Each general listing page has four sections of specific information. What is a better strategy for SEO: Using tabs (e.g. JQuery + CSS) and putting all content on one page (and will all of the content still be indexible using JQuery?) OR creating unique pages for each section. JQuery: sitename.com/listing-name#section1 Unique Pages: sitename.com/listing-name/section1 If I go with option one, I can risk not being crawlable by google if they can't read through the scripting. However, I feel like the individual pages will not rank if there's a small amount of content for each section. Is it better to keep all the content on one page and focus on building links to that? Or better to build out the section pages and worry about adding quality content to them so that long term there is more specificity for long tail search and better quality search experience on Google? We are also set up to have "../listing-type/listing-name" but are considering removing 'listing type and just having "../listing-name/". Do you think this more advantageous for boosting rankings? I know that was like five questions. I've been doing a lot of research and these are the things that I'm still scratching my head about. Some general direction would be really great! Thank You!
Intermediate & Advanced SEO | | knowyourbank0 -
Best SEO META Description for forum topics
What would be the best SEO META Description tag for forum topics on a forum type website? I can think of a few options so far Snippet of first post. Title of the topic with templated trailing text Remove description tag completely Your thoughts and suggestions are greatly appreciated.
Intermediate & Advanced SEO | | Peter2640 -
Meta keywords vs tags
On a blog from an SEO perspective how do you choose keywords to use in the "meta keyword tag" vs. "post tags"? Will it be different based on the search volume/competition of the keywords targeted?
Intermediate & Advanced SEO | | saravanans0