4

I have created a team site and now they are asking for a blog. I know I can create one separately but I'd like to keep it part of the team-site.

How do I do it? It's SharePoint online

Thank you

2

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 “Blog Content” -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:

2

Unfortunately

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

is not possible with SharePoint Online.

So You have to go with JavaScript code.

<script>
SP.SOD.executeFunc('sp.js', 'SP.ClientContext', LoadFeature);

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

function LoadFeature()
{
    context = new SP.ClientContext("SiteUrl");
    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());
    }
    );
}</script>

Edit any page and add given code in Script Editor WebPart or Content Editor WebPart.

After that edit the page where you want to keep blog web part and choose to Insert WebPart. And you will find Post WebPart.

enter image description here

Also 4 additional list has been created after successfully running the code.

  • Comments
  • Categories
  • Posts
  • Photos

Let me know if you still face any issue.

  • I still can't see Posts but regardless, I have no blog as such on my team-site there so what would I see? – JurajB Oct 5 '16 at 21:18
  • Its totally tried code and correct code. Check console while executing some script. There might be some error.. I checked the code first then I posted here. – Aakash Maurya Oct 6 '16 at 4:52
0

Please use command below :-

Connect-SPOnline -Url https://site.sharepoint.com -Credentials (Get-Credential)

Enable-SPOFeature -Identity "{0d1c50f7-0309-431c-ADFB-b777d5473a65}"

This will activate Blog feature in your team site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.