How To Store Articles?


#1

Hi,

I’ve been building an article site, and I am having some interesting issues. I have never stored articles before, and I would like to be able to store them with headlines, paragraphs and subtitles.

Can someone tell me what’s the best practice to store something like this? I was about to do it the hard coded way and just code each article and create it’s own route, but I figure there has to be a smarter way.

Can anyone offer some suggestions? Or examples of content sites with meteor?

Thanks,
S


#2

I would just store articles in the database, like so:

{
  "_id": "YiuJgRtZ5DscS4CWL",
  "headline": "Some headline here",
  "content": "This could be <em>HTML</em>",
  "subtitles": [
    "Not sure what this is",
    "Could be an array of strings"
  ]
}

And then your routes could simply contain an article ID (myapp.com/read/YiuJgRtZ5DscS4CWL) which would fetch that article and show its contents.


#3

Maybe also take a look at this package: friendly-slugs

And check out this project of mine: link.
Maybe I can help :smile: