It's hard to answer a question like this without actually doing the work for you... but - i'll try :)
First - decide what features - you need. Will you have multiple users posting entries? Do you want the posts to be search able? Do you want posts to have tags or categories?
Your first goal is to create the post / article. So push the post contents (title, author, content, etc...) to /posts/
Pushing the post (as opposed to set or update) creates a unique key at the posts path. Save that in a variable. Let's call that var post_id
Now, push the post ID to authors/author_id/posts/ - this will save the post id to the author (author_id) so someone can view all posts by that author - again, save this unique key in another variable - let's call this var author_post_id
If your gonna have categories or tags - again, push the post_id to that so - /categories/angularjs/ - save this to an ID (i'll explain in a bit) say: var category_post_id
Now we need to write both of these variables back to the post so do a update to /posts/post_id/ and set author_post_id to the variable and category_post_id to the variable. "set" in firebase will destroy all other data at a path - it's very very rare I use a set - always update or push.
The reason you need to do it this way is there is no way to make relationships in firebase. If, someday, you need to change the author of a post, or delete a post, or something unforseen, you'll need to track down these tertiary bits of data to deal with them also.
So when you need to delete a post (no longer needed / off topic, whatever) - you'll read from posts/post_id/ first, get the author_post_id and category_post_id - delete (remove) from those paths first, then remove from /posts/
(Assuming AngularJS)
So now - in your blog - do an ng-repeat on the posts/ path - get all your posts.
On your author page, do a ng-repeat on authors/author_id/posts/ and get that authors blog posts. Do an ng-include and include a post snippet template (say, author name, post intro and post image) and set a variable for article id you can use in firebase to pull the article contents.
And the same for a view all posts for a specific category.
For the authors and categories path - make sure you include enough information that you need there. Originally, in my system, I was only storing the post ID. Last week (coincidentally) I was browsing the site, noticed a few authors had a lot of posts and I wanted to search inside of their posts. I couldn't do that because I was only storing the ID. So on one of my admin pages, I added a function to find the article, copy the article title to the category entry and now I can search the title (on ng-repeat with a filter)
Searching articles is as simple as using a filter on ng-repeat ( ng-repeat='elem in posts | filter: search' where search is ng-model='search' in a text field
Deep searching, you'll need to use something else like ElasticSearch - which Firebase has a plugin for and is pretty easy to use.
Hope this helps - I know theres no real code here, but try, see if you get stuck - try to figure it out on your own and if you can't - ask for help.
This is a fantastic response. Many thanks for being so generous about your time and knowledge. I have a related question that I posted here: hshno.de/Sk1JudP-b. I'd very grateful if you could share your thoughts.
Mario Giambanco
Director of User Experience Development
It's hard to answer a question like this without actually doing the work for you... but - i'll try :)
First - decide what features - you need. Will you have multiple users posting entries? Do you want the posts to be search able? Do you want posts to have tags or categories?
Your first goal is to create the post / article. So push the post contents (title, author, content, etc...) to /posts/
Pushing the post (as opposed to set or update) creates a unique key at the posts path. Save that in a variable. Let's call that var post_id
Now, push the post ID to authors/author_id/posts/ - this will save the post id to the author (author_id) so someone can view all posts by that author - again, save this unique key in another variable - let's call this var author_post_id
If your gonna have categories or tags - again, push the post_id to that so - /categories/angularjs/ - save this to an ID (i'll explain in a bit) say: var category_post_id
Now we need to write both of these variables back to the post so do a update to /posts/post_id/ and set author_post_id to the variable and category_post_id to the variable. "set" in firebase will destroy all other data at a path - it's very very rare I use a set - always update or push.
The reason you need to do it this way is there is no way to make relationships in firebase. If, someday, you need to change the author of a post, or delete a post, or something unforseen, you'll need to track down these tertiary bits of data to deal with them also.
So when you need to delete a post (no longer needed / off topic, whatever) - you'll read from posts/post_id/ first, get the author_post_id and category_post_id - delete (remove) from those paths first, then remove from /posts/
(Assuming AngularJS)
So now - in your blog - do an ng-repeat on the posts/ path - get all your posts.
On your author page, do a ng-repeat on authors/author_id/posts/ and get that authors blog posts. Do an ng-include and include a post snippet template (say, author name, post intro and post image) and set a variable for article id you can use in firebase to pull the article contents.
And the same for a view all posts for a specific category.
For the authors and categories path - make sure you include enough information that you need there. Originally, in my system, I was only storing the post ID. Last week (coincidentally) I was browsing the site, noticed a few authors had a lot of posts and I wanted to search inside of their posts. I couldn't do that because I was only storing the ID. So on one of my admin pages, I added a function to find the article, copy the article title to the category entry and now I can search the title (on ng-repeat with a filter)
Searching articles is as simple as using a filter on ng-repeat ( ng-repeat='elem in posts | filter: search' where search is ng-model='search' in a text field
Deep searching, you'll need to use something else like ElasticSearch - which Firebase has a plugin for and is pretty easy to use.
Hope this helps - I know theres no real code here, but try, see if you get stuck - try to figure it out on your own and if you can't - ask for help.