Sunday, October 6, 2013

SharePoint 2013/2016: Adding a Blog to an Existing Site (without creating a new site)

Typically when you want a blog in SharePoint, you need to create a new site collection or a subsite using the Blog site template.



Sometimes it would just be easier (or nice) to have a blog right in another site such as a team site or departmental site without the need for yet another site collection or subsite to maintain. No problem.

You can easily add a blog to an existing site using PowerShell. Fire up the SharePoint 2013 Management Console and enter the following command:

Enable-SPFeature -identity "BlogContent" -url <<the url of the site>>



Next, navigate to the site in the browser and edit the home page:


From the Insert tab on the top ribbon, click on Web Part:




Select Posts from the Apps category and click on the Add button:



The blog posts now appear on your home page:




Click on the sample blog post:




You now have a blog in your existing site without having a separate subsite!


24 comments:

  1. While this is cool, what is the use case for this?

    ReplyDelete
    Replies
    1. If you want to have a blog within a site without having to go to a different url.

      Delete
  2. Better late than never, right?
    Anyway, this is exactly what I'm trying to do (Sharepoint neophyte!), but with SharePoint online. Do you know if this is possible?
    There does not appear to be a cmdlet equivalent for enable-spfeature in the SPO Powershell library that I can find.

    ReplyDelete
    Replies
    1. I haven't been in the online world in awhile. Maybe it's time to dive back in. I don't remember seeing too many SPO cmdlets. Hopefully they'll expand this. I am assuming the javascript object model is available. Maybe yoy can hack it that way. I'll take a look.

      Delete
    2. Yep! You can do something similiar to this: http://blogs.msdn.com/b/kaevans/archive/2013/10/05/enabling-the-developer-site-collection-feature-in-sharepoint-online.aspx

      I'll get you the feature guid.

      Delete
    3. I'm also interested in this - how would I transition from enabling the developer site collection in SP Online to the directions you list above?

      Delete
  3. Hi Steve, I've been trying to get the O365 Client Browser to work. I was able to get the GUID already but I can't seem to enable it that easily.

    Would you know how I can enable it using Client Browser?

    ReplyDelete
    Replies
    1. You can't enable through the browser. You would have to do something similar as in the blog post I mentioned in the previous comment.

      Delete
  4. You can run CSOM javascript to enable the Blog feature for SharePoint online.

    function ActivateWebFeature(web) {
    var guid = new SP.Guid('{0d1c50f7-0309-431c-adfb-b777d5473a65}');
    var featDefinition = web.get_features().add(guid, true, SP.FeatureDefinitionScope.farm);
    }

    var context = new SP.ClientContext.get_current();
    var web = context.get_web();

    //Activate Features
    ActivateWebFeature(web);

    context.load(web);
    context.executeQueryAsync(
    function () {
    window.console && console.info("Featured activated for Web: " + web.get_serverRelativeUrl());
    },
    function (sender, args) {
    window.console && console.info('Error: ' + args.get_message() + '\n' + args.get_stackTrace());
    }
    );

    ReplyDelete
    Replies
    1. Thank you for this post!!! Used it to add Blogging tools to a community site in SPO

      Delete
  5. There is a problem with this solution: after enabling the blog feature, 'save this site as template' no longer works - the procedure returns error - and even if you try to disable the feature the error persist. Anyone who faced it and resolved somehow?

    ReplyDelete
    Replies
    1. You can set the SaveSiteAsTemplateEnabled property to "true" on the SPWeb object to get back the Save Site As a Template link in Site Settings:
      Powershell:
      $web = Get-SPWeb http://mysharepoint/web
      $web.AllProperties["SaveSiteAsTemplateEnabled"] = "true"

      Delete
    2. The problem isn't the visibility of the link, but the fact that the saving procedure gives error. Even after disabled the blog feature.

      Delete
  6. With the summary view, I noticed that the href value of the post is blank. This makes the item link to the document library where the home page resides, and not to the proper post item.
    Do you know of any way to make the items link to the proper item? Other than writing some javascript, I am at a loss as to where the Posts Web part Summary View gets that URL... something in the SPWeb property bag maybe?

    ReplyDelete
  7. I figured it out. You need to have the "Blog Tools" web part on the same page. The Posts web part and the Blog Tools web part work together. Not very intuitive, but we really aren't supposed to have the blog stuff on a site other than a blog site.

    The good news is that if you are not a contributor to the site, the Blog Tools web part is hidden.

    ReplyDelete
  8. Wonderful post however I was wondering if you could write a little more on this topic? I’d be very thankful if you could elaborate a little bit further. Thank you!
    SharePoint Online

    ReplyDelete
  9. great post....! Thank you Steve.

    ReplyDelete
  10. Hello.
    Thank you for the wonderfull Post. I am unable to Enable Blog Content Query. I get following error:

    Enable-SPFeature: The Feature is not a Farm Level Feature and is not found in a Site level defined by the Url....

    I will be so appreciate if someone could help me.

    ReplyDelete
  11. Hi! Great and helpful post! Thanks!
    I try this for community site and got a little trouble: community feature and blog feature both use a Categories list. And when I activate blog feature it try to create/update Categories list. After that Categories list does not work properly.
    It's like an "Getting Error Message for Exception Microsoft.SharePoint.SPException: Cannot complete this action. Please try again." error, when I open a Categories list.
    I clear it with disabling blog and community features, delete all of these features content(lists) and activate blog feature again.
    I hope this can help to anyone.
    Sorry for my bad English :)

    ReplyDelete
    Replies
    1. Have the exact same issue. Which is odd - blogs and community sites should go hand and hand. I am guessing the Blog Feature that gets enabled wants to overwrite the categories, but isn't able to, and things get weird from there.

      Delete

Matched Content