Saving HTML for blog posts to a SQL database

zwinkyo

New Member
I'm a front-end dev learning .NET MVC and SQL while writing a very simple blog engine. I'd like to ask what's the best way to "save" and display HTML blog posts.I'm using VWD 2010 Express, MVC 4 and SQL Compact. The goal is to be able to display my blog posts in a feed and on their own page.At first, it seemed like it would be easiest to save blog post metadata to SQL including Title, Date, Author, and a URL to a partial HTML file that I could "include" (SSI) into my pages. Turns out SSI is frowned upon and I'd like to do this right (and couldn't get SSI working anyway). This would have been ideal because, as a front-end dev, I like tweaking the HTML and it would be easier if my blog posts were accessible HTML files rather than long strings inserted in a SQL table.I decided to try storing the HTML in SQL anyway. Opening my table in VWD's database explorer, I pasted a blog post's html into a new field called PostHTML. My controller gets the data, creates a data model instance called Post, and passes it to the View. When inserted into the page using Razor, the Title and Date fields work fine but the PostHTML field only contains the first line from the HTML that I pasted into it.Rather than trying everything I can think of, I'd like to focus my research on the best/correct way to save my blog posts. Please keep in mind that this is a learning project, to be updated only by me and possibly read by a few people at work. I'm aiming for simplicity. Maybe I should also mention that my posts are mostly about JavaScript and contain HTML encoded script block examples.
 
Back
Top