Page 1 of 1

Treat meta keywords as tags: ideas for database approach?

Posted: Mon Dec 22, 2008 10:18 pm
by JAB Creations
While Yahoo is the only one of the big three to take meta keywords in to consideration they are also necessary for WAI AAA compliance. I'd like to store them in a database table though treat them as tags. Each page may have up to a maximum of seven tags. The issue is how would I best approach such a setup? I could setup seven columns though I'm not sure that would be necessary.

Thoughts please?

Re: Treat meta keywords as tags: ideas for database approach?

Posted: Tue Dec 23, 2008 12:57 am
by VirtuosiMedia
JAB Creations wrote:While Yahoo is the only one of the big three to take meta keywords in to consideration they are also necessary for WAI AAA compliance. I'd like to store them in a database table though treat them as tags. Each page may have up to a maximum of seven tags. The issue is how would I best approach such a setup? I could setup seven columns though I'm not sure that would be necessary.

Thoughts please?
How about this approach: Each page has an ID as a primary key, in addition to other properties. The tags would be stored in a separate table, each tag with an ID and then the tag text. Then a third table would contain the associations between the pages and tags and would consist of the associationId (as a primary key), pageId (as a foreign key), and the tagId (as a foreign key).

Re: Treat meta keywords as tags: ideas for database approach?

Posted: Tue Dec 23, 2008 1:09 am
by alex.barylski
Not sure I understand but it sounds like you want to express an 1:n relationship in which case it's best done:

Code: Select all

Pages:
------
pkid, title, description, primary_content
 
Pages_Tags:
------------
pkid, fkid, tag_name
Alternatively you could store each keyword/tag in a CSV field but if you want to generate tag clouds like Yahoo the above scehma will make it much easier and more efficient I would imagine.

Re: Treat meta keywords as tags: ideas for database approach?

Posted: Tue Dec 23, 2008 1:16 am
by JAB Creations
VirtuosiMedia's idea makes me wonder why I hadn't thought of that...

I'm not thinking about tag clouds...I just want to make sure if there is some benefit I see in the future that I'll have a system already implemented that I can take advantage of.

The three table solution sounds beautiful. :)

CSV, comment separated values?

Re: Treat meta keywords as tags: ideas for database approach?

Posted: Tue Dec 23, 2008 2:24 am
by alex.barylski
Three tables is the most flexible approach...
CSV, comment separated values?
Comma separated values...like a CSV file or XLS