DEV Community

Cover image for How To Use Multiple Markdown Fields for Articles?
Quinn
Quinn

Posted on

How To Use Multiple Markdown Fields for Articles?

I've been working on a site for a few months and made the (potentially questionable) decision to build the thing from scratch using JQuery/Django/Python/Postgres. I've found that although the front-end work of the platform can be quite difficult, all that matters is that it works for the user.

This is different when it comes to the blog/forum/whatever you want to call it because the search engines and webmasters expect you to do very specific things in terms of structure.

I'm using markdown fields for the article content which I think is pretty typical. I have no issue integrating a header image followed by text. You can check out an example article here (I'm into cars btw): how much does it cost to wrap a car. This is ok, but I'd like to be able to include additional media like videos, graphics, etc.

Does anyone have experience in an option like wordpress where each section is defined as a media type? Eg first section is a markdown field with text, then a video field, then another markdown, etc. I'd be interested in hearing how this is structured from a database perspective.

My thought is that I could remove the individual markdownfield from the article model and replace it with a foreignkey to a 'media' model. Then use that to have separate sections that combine to create the article.

Would love some feedback on the approach or suggestions!

Top comments (0)