jr3 (63K)

Google Sets + Sed = Quick Keywords for Meta Tags

Posted by Jessica Tue, 17 Oct 2006 20:32:00 GMT

I know there is alot of talk about search engine optimization. Additionally, I have no idea whether or not keywords in the meta tag do anything to help people find your site. With that said, I want to share how to quickly generate and format keywords for the meta tag.

To generate keywords for a website, go to Google Sets. Enter some small group of keywords that describes your site. For example, if I were maintaining a site on machine learning, I might enter the following terms: machine learning & artificial intelligence. This search returns 40 to 50 keywords related to machine learning.

Copy these keywords into a text file and delete any that aren’t relevant or that are misleading.

Now, if you were to simply cut and paste this list of keywords into your HTML document, your document would be UGLY (eew!) and difficult to read. Who wants to read a file with that many carriage returns?

The solution is to replace all end of line characters with commas (except the last EOL), so that things look relatively nice and neat in an html or rhtml or whatnot file.

To replace the end of line characters with commas, use the following two linux commands:

  • sed ’/$/,/’ file1 > file2
  • paste -sd ’\0’ – file2 > file3

You don’t have to create two extra files, but I do because often I have compiled keywords from several searches and wouldn’t want to repeat the process if I messed up the sed and paste commands. Besides after I have inserted the keywords into my html, I simply delete the files.

After getting all of the keywords on one line, paste them into the ”<META name=”keyword” content=””> statement.


UPDATE
For Windows users, there are two things I can recommend you do if you would like to use these commands.
    First, if you are running a website that is on a server running linux, you can ssh into the server, upload the text file you would like to convert (file1 in my example), and then run sed and paste on that text file.

    Second, you can try to run GNU Bash shell on Windows or install Cygwin. I haven’t tried either of these options because both my Windows laptop and desktop died (RIP my sweet babies) a few months ago.
Trackbacks

Use the following link to trackback from your own site:
/blog/articles/trackback/194

Comments

Leave a response

Comments


designed by jowensbysandifer