This project is read-only.

Updating Blog Post Tags using code or TQSL

Topics: General, Writing modules
Jan 21, 2012 at 12:03 AM

I have just gone through a large migration of me blog from DotNetNuke and all was fine using the BlogML Importer (Works great) the problem was that the tags are handled differently in DNN and the blogML Exporter was not the best, I had to do several edits to get the xml correct. But know I would like to do some mass tagging.

The idea I am thinking of is to run some tsql to update the backend. What I was going to do in english was first make sure that there was a tag in the system, then go through the blog posts (Subject first) and search for that key word. I would then link that post to the tag. After this I was going to search the contents of the Blog Post for the Key word and add the link to the tag. When doing this making sure that the post didn't already have the tag linked.

I was thinking of TSQL First, but I am thinking that doing this ast a code or script level may make it easier for others to use if the wanted or found the need to.

Jan 21, 2012 at 12:07 AM

Ideally you could create the XML import file by yourself, but you would need to know the slug of the content item to link the tag to. Is it possible ?
If yes, just add a tag to a blog post, enable the Import/Export module, export the Blog Post and Tag data to a file, and see the result. Construct the same file with your data and import it.
If you are not satisfied with it I can explain the db schema for tags here. 

Jan 21, 2012 at 2:47 AM

Could you drop an explanation of the schema? Looking for the information relating to blog posts and the tags

I tried to de engineer the database and all tables where seperate, there was no relationships defined in the schema.

Jan 21, 2012 at 3:00 AM

It's easier to just use IContentManager to read the content database, and ITagService to create and set the tags.