Blog
Created by Orckestra
Adding a blog automatically
To add a blog to a website automatically:
- Make sure that the template used to create new pages includes two placeholders with IDs matching those defined in the Blog page type.
- From the Content perspective, select a page under which you want to create a new page for blog entries and click Add Page on the toolbar.
- In the Add Page wizard, fill out the fields, and make sure you selected the Blog page type in the Page type selector.
- Click Finish.
Selecting the Blog page type will add the Blog application and blog-related functions to the page.
You can either have a template (new or existing) with the needed placeholder IDs or edit the Blog page type and change the placeholder IDs to those used in your page templates.
If either or both IDs are not present in the template, the needed functions will not be added automatically and you will need to add them to the page manually.
Adding a blog manually
To add a blog to a website manually:
- In the Content perspective, right-click a page you intend for blog entries, click Add Application in the context menu, and add the Blog application.
- Edit this page and add the Composite.Community.Blog.BlogRenderer function ( Insert > Function) in Visual mode or insert the following markup on the page in Source mode:
Expand code - If necessary, specify its optional parameters:
- Blog Entries Count: The number of most recent entries to show on the page (5 by default).
- List options (BlogListOptions): Additional data to show when displaying blog posts in a list, such as the comments, image, teaser, content, author, date, tags, share icons, RSS link. (By default all data is displayed except for the image, content, RSS link.)
- Item options (BlogItemOptions): Additional data to show when displaying an individual blog post, such as the image, teaser, content, author, date, tags, share icons. (By default the author, date and content are only displayed.)
- Comments Service Key: The unique value identifying your website with a comment service you have registered with. By default this is SiteShortName for DISQUS (see below).
- If necessary, add an archive and a tag cloud to the page, too (see below).
Please also see "Importing posts from external blogs".
Adding the comments feature
You can use any third-party service as your blog comments feature. Originally, none is specified but you can use a unique value to identify your website with a comment service you have registered with. Below is the guide about adding the DISQUS comments to your blog.
To use the DISQUS service as your comment system in the blog on your website, you should have a DISQUS account and register this website with DISQUS.
- Log into your DISQUS account.
- Copy or make a note of the site shortname shown in the "Settings" under "Site Identity".
- Now log into the CMS Console of your website and edit the page with the Composite.Community.Blog.BlogRenderer function.
- In the function's properties, select the Comments Service Keys parameter, switch to "Constant" and enter the site shortname.
- Click OK to save the changes, then save and publish the page.
Showing the latest posts
You can display the concise list of latest five blog posts on any page on your website:
- Edit a page.
- Add the Composite.Community.Blog.Latest function ( Insert > Function) in Visual mode or insert the following markup on the page in Source mode:
Expand code - If necessary, specify its optional parameters:
- Count: The number of latest posts from one or more blogs to show on the page (5 by default).
Adding an archive
To allow the user to view older entries, consider adding an archive to the blog:
- Edit the page with the blog entries.
- Select the place where the archive links must appear. (If necessary, edit the page layout.)
- Add the Composite.Community.Blog.Archive function ( Insert > Function) in Visual mode or insert the following markup on the page in Source mode:
Expand code - The function groups all the entries by month (incl. the year) and display the links to the groups (months) indicating the number of entries posted in that specific month.
Adding a tag list
To allow the user to filter blog entries by tags (subjects), consider adding a tag list to the blog:
- Edit the page with the blog entries.
- Select the place where the tag cloud must appear. (If necessary, edit the page layout.)
- Add the Composite.Community.Blog.TagList function ( Insert > Function) in Visual mode or insert the following markup on the page in Source mode:
Expand code
The function groups all the entries by tag and displays the links to the groups (tags) indicating the number of entries posted with that specific tag.
How to show posts from all the blogs
If you have more than one blog on the same website and want to show the blog posts on a page other than any of the "blog" pages (where the Blog application is attached):
- Set the Show posts from all blogs (isGlobal) parameter on the Composite.Community.Blog.BlogRenderer function to 'True'
The posts from all the blogs will be listed on this page. When the user opens an individual post, he or she will be redirected to the respective "blog" page where the post belongs.
You may also consider showing tags and archive from all the blogs on this "non-blog" page (see below).
How to show tags from all the blogs
If you have more than one blog on the same website and want to show the tags from them all on a page other than any of the "blog" pages:
- Set the Show tags from all blogs (isGlobal) parameter on the Composite.Community.Blog.TagList function to 'True'
- Make sure the Blog Page parameter is not set to a specific page (and the default value is used).
How to show the archive from all the blogs
If you have more than one blog on the same website and want to show the archive for all the blogs on a page other than any of the "blog" pages:
- Set the Show posts from all blogs (isGlobal) parameter on the Composite.Community.Blog.Archive function to 'True'
- Make sure the Blog Page parameter is not set to a specific page (and the default value is used).
Please note that you shouldn't set this parameter on a specific "blog" page because the archive of this blog will be listed automatically.
Adding a blog author
Before posting on a blog, at least one blog's author must be added. When you install the package, an author named "Anonymous" is added. You can add a new author or edit and reuse the "Anonymous" author.
To add an author:
- In the Content perspective, expand Website Items, then Blog Settings.
- Under Blog Settings, select Authors and click Add Author on the toolbar.
- Fill out the required field:
- Name: The name of the blog's author. Also used as the username to post to the blog from external applications (Windows Live Writer etc) via MetaWebBlog (see below).
- Fill out the optional fields if needed:
- Email: The author's email address. (The author will receive notifications by email at this address on new comments if the "Notify on new comments" option is turned on on a blog entry.)
- Picture: The photo or image to graphically represent the blog's author.
- Display Email: If checked, the author's name on a blog entry will be linked to the author's email address by clicking which a reader can send an email to the author; otherwise, no link.
- Password: The password used by the author to post to the blog from external applications (Windows Live Writer etc) via MetaWebBlog. External posting is impossible when the password is blank.
- Click Save.
Adding a tag type
Tag types allows you to group tags.
At least one tag type must exist before you can add tags. The Blog add-on comes with a default tag type called "Topics".
To add a tag:
- In the Content perspective, expand Website Items, then Blog Settings.
- Under Blog Settings, select Tags and click Add Tag Type on the toolbar.
- Type the name of a tag type in the Name field.
- Click Save.
Adding a tag
Tags help classify blog entries by subject and allow blog readers to filter blog entries by these subjects.
Before posting on a blog, you can specify one or more tags. When you install the package, a tag named "About" is added.
Before adding a tag, at least one tag type must exist. The Blog add-on comes with a default tag type called "Topics".
To add a tag:
- In the Content perspective, expand Website Items, then Blog Settings.
- Under Blog Settings, select Tags and click Add Tag on the toolbar.
- Type the name of a tag in the Tag field.
- Select the tag type from the Tag Type list.
- Specify the tag's position in the Position field.
- Click Save.
The tags are ordered by the position if specified. If the Position field is left blank, the tag will not be ordered.
You can also select a tag type already present in the tree and add a tag from there. In this case, this tag type will be pre-selected in the Tag Type field.
Posting from the CMS Console
- From the Content perspective, expand the page with the blog entries and select BlogEntries under the page.
- Click Add Blog Entry.
- On the Settings tab, fill out the following fields:
- Title: Type the title of the blog entry. (Consider a short title for quick reference in lists and feeds.)
- Image: Select the image to illustrate the blog entry. Keep the <NONE> option to assign no image. (Note: The sizes of the image can be customized in the CSS - please see Customization below.)
- Teaser: Write the summary or highlights of the blog entry's content. (Consider a short description, one or two lines long.)
- Date: Select the date of the blog entry's publication.
- Author: Select the name of the blog entry's author. (Note: You must set up at least one author before posting entries.)
- Display comments: Select this option to allow displaying comments to the blog entry. (The blog entry will include the form to submit comments and the comments if any).
- Within the Tags group box, select one or more tags to assign to this blog entry by placing a check mark in a corresponding check box. (Note: To be able to select tags, you must set them up before posting entries.)
- On the Content tab, write the text for your blog entry.
- Click Save.
- Click Publish when the blog entry is ready for publication.
Importing posts from external blogs
You can import posts from an external blog via its RSS feed:
- In the Content perspective, expand the page where the blog is implemented.
- Select "Blog Entries" and click "Import from RSS Feed" on the toolbar.
- In the popup window, specify the RSS feed URL of the blog to import. (RSS 2.0 and Atom 1.0 are supported.)
- Click Finish.
What additionally gets imported:
- Authors: Authors of the individual posts are preserved and added as blog authors (Content / Website Items / Blog Settings / Authors). If posts have no author, the original blog's author is used if specified in the RSS feed. Otherwise, the author already added in the CMS Console will be used. If no author or multiple authors are already added in the CMS Console, the "Anonymous" author will be used.
- Tags: Tags are preserved and imported
- Media: All the internal images, PDFs, DOCXs get imported into the media archive (Media / Media Archive / BlogMedia) and respective media URLs are updated. URLs to external media are not changed.
- Dates on posts: Dates are preserved and imported when specified, otherwise the current date is used.
- Links: Internal links to other posts in the imported blog are not changed but prepared for remapping (see "Remapping old post URLs to new ones" below).
Please note that since no content is imported into "teasers" of blog posts, you may want to consider showing content in the blog list rather than teasers. (Please see "Adding a blog manually", Step 3 above.)
Remapping old post URLs to new ones
Internal links to other posts in the imported blog are not changed but stored in ~/App_Data/RequestUrlRemappings.xml
.
It is a ready-to-use remapping configuration file, which should work out-of-the-box with the URL remapping tool described in "URL remapping" when implemented.
Posting from Windows Live Writer
Before you post to your blog, make sure you have set up the blog account providing the correct Blog Post URL to your website:
- Click Home, Blog, Add Blog Account.
- On the Blog Services page, select Other Services and click Next.
- On the Blog Account page, set these parameters:
- Web address of your blog: Type in http://<hostname>/ (e.g. http://www.contoso.com/)
- User name and Password: Type the name and the password you have set up when adding an author in the console. (Optionally, you can select to remember your password.)
- On the Blog Type page, set these parameters:
- Type of blog you are using: Select Metaweblog API
- Remote posting web address for your blog: Type in http://<hostname>/BlogMetaWeblog.ashx (e.g. http://www.contoso.com/BlogMetaWeblog.ashx)
- On the Select Blog page, select the blog you want to post to and click Next.
- Optionally, you can choose to download a publishing theme to view what the blog post will look like.
- Click Finish, to confirm the name of, and save, the blog.
Now in the opened document, type in the title, select the Account if necessary, and start writing your post. Once done, click Publish.
(Please refer to the standard Windows Live Writer 2011 documentation for more information.)
Posting from Microsoft Word 2007
Before you post to your blog, make sure you have set up the blog account providing the correct Blog Post URL to your website:
- Click the Office Button, Publish, Blog.
- Click Blog Post, Manage Accounts.
- In the Blog Accounts window, click New.
- For the blog provider, select Other and click Next.
- In the New Account window, set these parameters:
- API: Select MetaWebLog
- Blog Post URL: Type in http://<hostname>/BlogMetaWeblog.ashx (e.g. http://www.contoso.com/BlogMetaWeblog.ashx)
- Name and Password: Type the name and the password you have set up when adding an author in the console. (Optionally, you can select to remember your password.)
- Back in the Blog Accounts window, you can set the newly added account as default.
- Click Close.
Now in the opened document, type in the title, select the Account if necessary, and start writing your post. Once done, click Publish.
(Please refer to the standard Microsoft Word 2007 documentation for more information.)
Using the RSS feed
The Composite.Community.Blog supports exporting blog entries as an RSS feed. The user can access the RSS feed URL via the "RSS" link at the bottom of a blog entry (in the "content" mode of the blog list) which is generated automatically.
In general the feed can be accessed as:
- http://<server_name>/BlogRssFeed.ashx?bid=ce81e280-3caa-498a-aeec-ab58b576c891&cultureName=en-us
where:
- 'bid' is a required parameter that contains the GUID of the page where the blog is
- 'cultureName' is a parameter that specifies the culture name of a localized version of the blog. If not specified, the default language of the website is used.
To manually create an URL to the RSS feed, you should at least specify the 'bid' parameter.
Accessing blog posts via Web API
You can load blog posts using Web API.
Note. You need to install Composite.AspNet.WebAPI to be able to use Web API with the blog.
By using Web API requests, you can retrieve information about blog posts - the title, the URL to the blog post, used tags, the URL to the associated image.
To access all the posts, append /api/blog/items
to the website address, for example:
http://www.contoso.com/api/blog/items
You can narrow the request by using the query parameter in the URL such as:
- BlogPageId: The ID of the page the blog is associated with. Using it makes sense if there are two or more blogs on the website
- PageSize: The number of blog posts to retrieve when splitting them between multiple pages
- PageNumber: The number of the page to use if the blog posts are split between pages.
- CultureCode: The culture code (for example, en-US, or fr-CA) to use. Using it makes sense if the blog is in multiple languages.
- Tags: The tags the blog post must be assigned to in order to be retrieved.
For example:
http://localhost:1809/api/blog/items?BlogPageId=&PageSize=8&PageNumber=2&CultureCode=en-US&Tags=CMS
When requesting blog posts via Web API, please consider the following:
- All parameters are optional.
- If BlogPageId is not specified, the posts are loaded from all pages with blogs.
- If PageSize is 0, then all posts are loaded.
- The default value for the PageNumber is 1.
- The default value for the CultureCode is the default culture in the system.
Localizing the blog
The strings used in the Blog package are stored in the resource file at: App_GlobalResources\Composite\Community\Blog.resx. To localize the strings:
- Make a copy of this file and name the copy by appending the language code (e.g. 'da-DK') to its file name (model: {FileName}.{LanguageCode}.resx): e.g. Blog.da-DK.resx
- Edit the created file and replace strings in English with strings translated into the target language.
- Save the file.
Customizing the blog
You can customize the layout by editing the style sheets:
/Frontend/Composite/Community/Blog/Styles.css
To set up sizes of the image assigned to a blog entry, customize the <img> element of the BlogItem class in the style sheet. E.g.:
.BlogImage {width: 100px; height: 100px;}