Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am working on a website that will contain a lot of content and I would like to add ability to tag content, just like Stackexchange does, where each question can be tagged by maximum 5 tags.

Now, I would like to use Google to search for all pages tagged by certain tag.

I thought of enclosing each tag inside special characters like this:

tags: {mytag},{google},{tags}

and then seach for {mytag} in Google.

However, it seems Google ignores special characters. What would be the best way to accomplish this?

share|improve this question

migrated from webapps.stackexchange.com Mar 5 '13 at 8:57

This question came from our site for power users of web applications.

1 Answer 1

up vote 0 down vote accepted

There are a few ways to accomplish this, however, assuming that you are referring to a Google Custom Search Engine for your site, the simplest way would be as follows:

  1. Maintain a page for each of your tags with a URI similar to /tagged/mytag (where mytag is a given tag - each tag should have its own page)

  2. Allow documents which match a tag to be indexed by ID or slug under /tagged/mytag/myid or /tagged/mytag/mydocument and ensure that documents include a canonical URL

  3. When a "tag search" option is specified, append the following to the search query string: inurl:/tagged/mytag (where mytag is whichever tag the user specifies)

You can test to see which results will display by searching site:example.com inurl:/tagged/mytag at Google (in this case, the format demonstrated should work with a default WordPress installation).

This should present users with a list of results which (a) match their query string and (b) are tagged as the user has specified.

Note: The OpenSearch specification references a "tags" element - to the best of my knowledge, however, this element is not presently supported with Google searches (though many browsers - including Google Chrome - already support some OpenSearch-powered functionality).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.