2

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?

0

1 Answer 1

0

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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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