There are multiple ways to build a blog system, public/private, multi-user vs single, etc. Here, the goal is not to build a generic blog management system that would fit any /all requirements, but rather to focus on a single use case. For the purposes of this tutorial, we used requirements from our recent project to establish an internal blog at eXo – a blog for employees to share internally what they do, what they like. We are a global company, with eXoers all around the world. Since we are using the social intranet from eXo Platform 3.5, the new blog will be a simple system open to all intranet users.
eXo Platform really shines when it comes to live development. So you could very well – as we did initially – build this blog system entirely from the UI. We added pages with the portal UI, created the data structure in the ECM Admin and coded all the templates in the embedded IDE. Everything live, without a single server restart.
However, to make it easier to reuse and share with you, we finally ended up creating an installable extension. To learn more about how to create a new extension, please see our eXo Platform Developer Guide.
Any code or config shown below can be found in this Git repository: https://github.com/exo-addons/blog-extension
The very first step is to to define a set of pages.
/blog: the blog homepage, where post excerpts are listed
/blog/add: the form where users can quickly add a new post
/blog/admin: the blog back office where posts are managed
/blog/article: the page where each complete article is displayed
Let’s start with the navigation.xml (see code)
Quite easy, right ? Two things to note: page-references explicitly refers to intranet portal, as our extension sits on top of it. Also note the HIDDEN visibility, which will be interpreted by not generating a menu entry on the frontend (portal admins have the ability to edit them of course).
Let’s see how it goes. Login as an admin, then Edit > Site > Navigation. You should see the new navigation:
Next, we need to point the navigation to real pages.
/admin will use the Content Explorer (aka File Explorer Portlet)
/article will use the Content Detail (aka Single Content Viewer)
/blog will use the Content List (aka Content List Viewer)
/add will use the Fast Content Creator
Here’s an excerpt of the pages.xml (see code)
That’s it. We now have the page structure for our blog system. Login as any user, and you should see the Blog menu and try the URLs.
Now, to get something functional we need to invite WCM to the party. Since any user can be a potential blogger, we’ll store the blog posts in a location that is available to all: /Users/platform/users/Documents. The CLV (Content List Viewer) can then be configured accordingly:
<preference> <name>folderPath</name> <value>repository:collaboration:/Groups/platform/users/Documents</value> <read-only>false</read-only> </preference>
We need to tell the CLV to display the /blog/article page when we click on one of the items in the list:
<preference> <name>basePath</name> <value>blog/article</value> <read-only>false</read-only> </preference>
And of course, the quickpost form should also point there:
<preference> <name>path</name> <value>/Groups/platform/users/Documents/Blog</value> <read-only>false</read-only> </preference>
Finally, let’s tell the Content Explorer to use the Users drive so that it will display our posts:
<preference> <name>driveName</name> <value>users</value> <read-only>false</read-only> </preference>
That’s it. We now have a rudimentary yet fully functional blog system.
Give it a try: log in as admin and go to http://localhost:8080/portal/intranet/blog/add.
Finally, click on the post title to verify that your article displays under http://localhost:8080/blog/article.
We’ve demonstrated how to build a rudimentary blog system in minutes, using the powerful portal and content management constructs that come with eXo Platform 3.5. In part 2 we’ll add a little more coolness to the blog, by making it easy for even non-technical employees to use.