Extend base Blog functionallity

Topics: Customizing Orchard
Oct 20, 2013 at 5:21 PM
Edited Oct 20, 2013 at 6:09 PM
Hi there!
I've just started learning Orchard CMS and thinking how should I implement my site.
My site is a multi-user content system, every authenticated user can add posts to a Blog from front-end not admin dashboard. The Blog module is one for all users. Users can edit/delete only own posts.
Post is a object with many pages. The first page is contents page and generating automatically. When user starts a post the first he needed to specify page title which will be used for table of contents. Then users writes text in a editor (CKEditor for example, it doesn't matter). Later user could delete/edit/rearrange pages in the post.

Could you give me an idea how could I implement this functionality? Could I take default Blog module and start rewrite logic of this module? Or it is better to copy all default Blog module sources to a new module project MyExtendedBlog for example and work on it?
The main problem for me is a pages inside a post. I can't find that anybody implemented this feature and my experience in the Orchard is a three days only.
Oct 20, 2013 at 10:59 PM
Rewriting all blog logic is too much work I think, an I don't think you would need to do so. The blog module doesn't do much about composing/posting blogs anyway. It deals with blog specific stuff like archives etc. The body part is added to blog post content type definition in the migration class.

In admin dashboard, when you edit a blog post, it's a single content item with fields and parts. In case of multiple pages, it makes more sense to me (in case of Orchard) to consider them as seperate content items, edit them seperately and create a relation between them to display navigation links (on frontend) and handle publish/rearrrange (when editing).

To do this, you will need to create a content part (or parts), attach it to blog post content type, and maybe to page content type (or your own version of page content type), depending on how you will harmonize all together.

If you haven't read yet, http://docs.orchardproject.net/Documentation/Creating-1-n-and-n-n-relations

Alternatively, you can use a content picker field for "next page". I don't have any experience with this one, but it seems it can be used to create relationships btw blog posts and their pages.

Oct 21, 2013 at 2:04 PM
Edited Oct 21, 2013 at 6:36 PM
Thank you very much for ideas. I am reading docs now and analyzing what you wrote above. I want to implement the following scenario for adding new content to the blog:
1) User clicks "Add post" button and goes to the form with one field post title and one button: "add page"
2) User clicks "Add page" button and goes to the form with fields page name and page text. There is a button "Save"
User could add many pages to a post.

Each post with pages has it's own SEO url, like this:
Initial post with table of contents:
All other pages inside post:

When users visiting pages I would like to show widget to show all pages in the current post.
Also users could add comments to the post, not to the individual pages.
I don't understand for now, should I create new orchard module of should I change code in the default Blog implementation?

Added after several hours.....

I found interesting module in the Gallery - NGM.Foum. I think this project is more suitable for my requirements. This forum has content types called
  • forum: root object, in my model it is the first blog post
  • thread: in my model it is act like a page inside post
I think I should make copy of this project and extend/rewrite it for my requirements. I think I should
  • update view for the initial "forum" page to render table of contents
  • update routing to build URL to the individual pages like /post_seo_url/page_seo_url
  • attach comment to the "forum" object
Am I on the right way or I am going to write very complex logic?