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
-
Why is our website not generating organic traffic?
Our website is struggling to generate organic traffic over the past few months and we're lost as to why. It's a relatively new site. It's mobile friendly, all products have meta descriptions and product images have alt tags. Content is added regularly. Site speed could be better and alt tags need to be added to images on the blog but other than that we're stumped. Does anyone have any suggestions?
Intermediate & Advanced SEO | | Johnny_AppleSeed0 -
Structured Data + Meta Descriptions
Hey All, Was just looking through some google pages on best practices for meta descriptions and came across this little tidbit. "Include clearly tagged facts in the description. The meta description doesn't just have to be in sentence format; it's also a great place to include structured data about the page. For example, news or blog postings can list the author, date of publication, or byline information. This can give potential visitors very relevant information that might not be displayed in the snippet otherwise. Similarly, product pages might have the key bits of information—price, age, manufacturer—scattered throughout a page. A good meta description can bring all this data together. For example, the following meta description provides detailed information about a book. " This is the first time I have seen suggested use of structured data in meta descriptions. Does this totally replace a regular meta description or will it work in conjunction with the regular meta description? If I provide both structured data and text, will the SERP display text and the structured data the way it was previously displayed? Or will the 150 -160 character limit take precedence and just cut off all info after that?
Intermediate & Advanced SEO | | Whebb0 -
Does Unique Content Need to be Located Higher on my webpages?
I have 1 page that ranks well with unique written content located high up on page (http://www.honoluluhi5.com/new-condos-in-honolulu/). I struggle to rank for 200+ other pages where unique content requires scrolling (ex: http://www.honoluluhi5.com/oahu/honolulu-homes/). I am thinking to do as follows: Change layout of all my pages to have unique content higher on page When users are on my site (not coming from search engines) and use my search filters, then users will land on pages where unique content is lower on page (so keep this layout: http://www.honoluluhi5.com/oahu/honolulu-homes/). I will then add these pages to my robots.txt file so they do not show in Google's index. Reason: unique content lower on page offers best user experience. With unique content higher on page, I expect bounce rate to increase about 10% (based on the 1 page I have with unique content higher), but I think it is worthwhile, as I am sure search engines will start having my pages rank higher.
Intermediate & Advanced SEO | | khi50 -
SERP display switching between normal meta description and 15+ items
The site, www.myrtlebeach.com has been having an issue with the way it displays in search results for the keyword "Myrtle Beach hotels". It is showing as a bulleted/itemized list similar to what's mentioned in this Moz article I'll begin with a little background. When I started working with the site it would display in SERPs as: Myrtle Beach Hotels - Reviews, Deals, & Photos - MyrtleBeach.com
Intermediate & Advanced SEO | | Fuel
www.myrtlebeach.com/hotels/
70+ items - Compare Lowest rates & see reviews on Myrtle Beach Hotels
from $76. Holiday Inn Club Vacations Myrtle Beach - South Beach offers a ...
from $27. Located among the south end Myrtle Beach hotels, Holiday Sands ... We did not want the site showing as an itemized list with 70+ items. We wanted it to show with the meta description we provided.
Our first attempt at getting the SERP to display our normal meta description was to simply change the meta description. That didn't work. Our second thought was to use pagination to reduce the number of items on the page. A few days after we implemented pagination we saw our normal meta description displaying in the SERP. Shortly after that we saw the SERP had reverted, but this time was showing 15+ items rather than 70+. This is when began seeing the SERP display change between a normal meta description and 15+ items. In another effort to stop the 15+ items from displaying in SERPs, we added relevant blog content like "Top 10 Oceanfront hotels" and "Best Kid Friendly Hotels" to break up the hotel listings on http://www.myrtlebeach.com/hotels/. Again, our normal meta description displayed in the SERPs for the next few days, but shortly after reverted back to 15+ items. Since then we have been seeing the SERP switch between our normal meta description and 15+ items with no rhyme or reason. Because our listings are not using , I'm not really sure why the site would be displaying this way. Since I have been regularly monitoring the SERP for the keyword "Myrtle Beach hotels", myrtlebeach.com/hotels/ has ranked as high as 5 and as low as 10. I open an Incognito Window and I take screenshots almost daily. I then record how the site was displayed in the SERP and its rank. I also look at organic visits and a Value Per Entry metric I've created. (I looked at Value Per Entry to determine if someone seeing 15+ items was more apt to convert) Average Visits on days with a normal meta description - 182
Average Visits on days with itemized 15+ description - 174 Average Value Per Entry on days with a normal meta description - 131
Average Value Per Entry on days with itemized 15+ description - 120 Average Rank on days with a normal meta description - 7
Average Rank on days with itemized 15+ description - 6 This data shows that performance is better on days when the normal meta description is displayed regardless of rank. I have linked 2 screenshots for reference. The 2-6-14 screenshot shows the SERP display with 15+ items and the 2-7-14 screenshot shows the SERP display with the normal meta description we provided. My questions are:
1. How does Google determine if a site should display in SERPs with an itemized or bulleted list?
2. Is there something else I need to change on myrtlebeach.com/hotels/ to prevent it from displaying in SERPs with 15+ items? m4znToY PRdDXZf0 -
Should I remove all meta descriptions to avoid duplicates as a short term fix?
I’m currently trying to implement Matt Cutt’s advice from a recent YouTube video, in which he said that it was better to have no meta descriptions at all than duplicates. I know that there are better alternatives, but, if forced to make a choice, would it be better to remove all duplicate meta descriptions from a site than to have duplicates (leaving a lone meta tag description on the home page perhaps?). This would be a short term fix prior to making changes to our CMS to allow us to add unique meta descriptions to the most important pages. I’ve seen various blogs across the internet which recommend removing all the tags in these circumstances, but I’m interested in what people on Moz think of this. The site currently has a meta description which is duplicated across every page on the site.
Intermediate & Advanced SEO | | RG_SEO1 -
Is it possible to "undo" canonical tags as unique content is created?
We will soon be launching an education site that teaches people how to drive (not really the topic, but it will do). We plan on being content rich and have plans to expand into several "schools" of driving. Currently, content falls into a number of categories, for example rules of the road, shifting gears, safety, etc. We are going to group content into general categories that apply broadly, and then into "schools" where the content is meant to be consumed in a specific order. So, for example, some URLs in general categories may be: drivingschool.com/safety drivingschool.com/rules-of-the-road drivingschool.com/shifting-gears etc. Then, schools will be available for specific types of vehicles. For example, drivingschool.com/cars drivingschool.com/motorbikes etc. We will provide lessons at the school level, and in the general categories. This is where it gets tricky. If people are looking for general content, then we want them to find pages in the general categories (for example, drivingschool.com/rules-of-the-road/traffic-signs). However, we have very similar content within each of the schools (for example, drivingschool.com/motorbikes/rules-of-the-road/traffic-signs). As you could imagine, sometimes the content is very unique between the various schools and the general category (such as in shifting), but often it is very similar or even nearly duplicate (as in the example above). The problem is that in the schools we want to say at the end of the lesson, "after this lesson, take the next lesson about speed limits for motorcycles" so there is a very logical click-path through the school. Unfortunately this creates potential duplicate content issues. The best solution I've come up with is to include a canonical tag (pointing to the general version of the page) whenever there is content that is virtually identical. There will be cases though where we adjust the content "down the road" 🙂 to be more unique and more specific for the school. At that time we'd want to remove the canonical tag. So two questions: Does anyone have any better ideas of how to handle this duplicate content? If we implement canonical tags now, and in 6 months update content to be more school-specific, will "undoing" the canonical tag (and even adding a self-referential tag) work for SEO? I really hope someone has some insight into this! Many thanks (in advance).
Intermediate & Advanced SEO | | JessicaB0 -
Is a separate title tags and description reqquired
is it a separate title tags and description for all pagination pages. We have common title tag and meta desciption of all pagination pages should we need to modify the same
Intermediate & Advanced SEO | | Modi0 -
Generating 404 Errors but the Pages Exist
Hey I have recently come across an issue with several of a sites urls being seen as a 404 by bots such as Xenu, SEOMoz, Google Web Tools etc. The funny thing is, the pages exist and display fine. This happens on many of the pages which use the Modx CMS, but the index is fine. The wordpress blog in /blog/ all works fine. The only thing I can think of is that I have a conflict in the htaccess, but troubleshooting this is difficult, any tool I have found online seem useless. Have tried to rollback to previous versions but still does not work. Anyone had any experience of similar issues? Many thanks K.
Intermediate & Advanced SEO | | Found0