No full width column option in subsite?

Contributor

I've created a subsite for my communications night, and I need to create a full width column to house my hero content?

Is there any reason why this is not available to me?

 

Thanks

 

17 Replies

@Lee-Martin 

How did you create the subsite? Through the UI?
Then you most likely created a team site, not a communication site.

 

Full-Width sections are not available on team sites.

There does not seem to be an option in the UI to create a communication site as a subsite.


So you need to use PNP PowerShell to connect to the parent site and execute these commands:

$Locale = 1031 #1033 English /1031 German
$SiteUrl= "MySubsite"
$Template = "SITEPAGEPUBLISHING#0" #Communication Site

New-PnPWeb -Title $SiteUrl -Url $SiteURL  -Locale $Locale -Template $Template 

Best Regards,

Sven 

Thanks, I just created the subsite through the UI as the main site is a Communication site - can I just add a Communication site as a subsite using these commands?
Hello Lee,
What column you are referring, is it for List/library columns (fields) or page layout on modern UI.
Follow below link for setting list based column width using JSON:
https://mstechtalk.com/customizing-sharepoint-list-add-edit-form-layout-using-json/

And for modern home page in subsite, you can use single column web part container or you can also add a custom css using SPFx web part.
@Adnan Amin

It's layout on a page

Where do I get to change the JSON? I do not appear to have that option

Hi @Lee-Martin,

yes, you need to connect to the main site using PNP Powerhshell and then execute the upper commands to create a communication subsite.

Best Regards,

Sven

@SvenSieverding is there a command to do this via SharePoint PowerShell?

Hi @Lee-Martin ,

 

Yes

1) Install PnPPowershell (https://pnp.github.io/powershell/) (As local administrator)

Install-Module -Name PnP.PowerShell

 2) Connect to your main site

Connect-PnPOnline "https://tenant.sharepoint.com/sites/yoursite" -Interactive

3) Create the subsite

New-PnPWeb -Title "My Communication Subsite" -Url "MyCommunicationSubsite"  -Locale 1033 -Template "SITEPAGEPUBLISHING#0"


If you don't want to use PnPPowershell, but pure CSOM Powershell instead, then take a look at this article
https://www.sharepointdiary.com/2016/05/sharepoint-online-powershell-to-create-subsite.html
and the section "SharePoint Online: PowerShell to Create Subsite"

Best Regards,
Sven

@SvenSieverding

I'm having access issues with PnP, but I've got SharePoint Powershell working - I've already got the URL you've shared with me.

However the PnP example you've shared seems a lot more simple than both the PnP and SharePoint Powershell examples here?

Hello @Lee-Martin 

Do wou mean the "SharePoint Online Management Shell"? (https://learn.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/introduction-sharepoint-on...

I don't think creating a subsite works with that, as you are connected with the admin-site and not the sitecollection where you want to create the subsite.

The subsite creation process needs these 4 parameters to work

  • Title : The title of the new subweb
  • Url: the relative path between parent and subweb (the name of the subweb in the url)
  • Locale: The locale of the site (1033 is for english)
  • Template: The template to base the site on. "SITEPAGEPUBLISHING#0" is a communication site.

I just inlined all these parameters into a single powershell call:

 

New-PnPWeb -Title "My Communication Subsite" -Url "MyCommunicationSubsite"  -Locale 1033 -Template "SITEPAGEPUBLISHING#0"

 



I often use PnP Powershell with the "-DeviceLogin" parameter.

Connect-PnPOnline "https://tenant.sharepoint.com/sites/yoursite" -DeviceLogin​

I think it is the easiest connection parameter with PnP Powershell. You could give that a try.

 



Alternatively we could create the subsite directly in your Browser using javascript. 

  • Open your Browser (I use Chrome) and go to your site where you want to create the subsite.
  • Go to "Gear"->Site Information->View all Site Settings    (Or to any other classic page)
  • Open your browser's developer tools by pressing "F12"
  • Insert the following javascript into the console (paste it in a single line, not as multiple lines)
  • Press Enter

    f12console.png
fetch(_spPageContextInfo.webAbsoluteUrl + "/_api/web/webinfos/add", {
  method: 'POST',
  credentials: 'include',
  headers: {
    'Accept': 'application/json',
	'Content-Type': 'application/json',
	'X-RequestDigest': document.getElementById("__REQUESTDIGEST").value
  },
  body: JSON.stringify({
                     'parameters': {                                   
					   'Url': 'MyCommunicationSubsite2',                        
                       'Title': 'My Communication Subsite', 
                       'Language': 1033,                                             
                       'WebTemplate': 'SITEPAGEPUBLISHING#0'                      
                       }           
                  })
})

That uses a webservice to create the subsite. Just change URL and Title in lines 11&12 according to your needs.

Best Regards,
Sven





 

@Lee-Martin What is the outcome goal you were trying to get to when you created the subsite in the first place? Modern site architectures are "flat" - so communication sites are not designed to have subsites. In fact, you cannot create a communication site that is a subsite so if you did create a subsite, it is a team site. As a best practice, I would not recommend creating subsites - even if you technically can. (I almost always disable subsite creation at the tenant level.) Instead, I would ask why you created the subsite? If you are looking to make a relationship between two sites, consider making one a hub and associating the other site to it. That way, both sites are communication sites - with the benefit of the full width section you want - and you can share navigation and search scope and theme without having to use subsites. But, you get the benefit of governance and permissions independence. If all you want to do is surface content from Site A on Site B, you may be able to use the News or Highlighted Content web parts on Site B and select Site A as the source. See: Planning your SharePoint hub sites - SharePoint in Microsoft 365 | Microsoft Learn. For fun, you can also take a look at Goodnight, Subsites a holiday story for IT (microsoft.com).

@Susan Hanley

I originally wanted one site, however I have a requirement that different sections require different branding, and as you cannot use multiple themes, subsites is my solution - I have been explicitly told not to use hubs
If you want to use different branding and you can't make it so that all sites share the same theme as you would get with a hub, I would still not use subsites. You will have a much more "future proof" scenario if you make separate sites and connect the sites with links and roll up web parts (e.g. News, Highlighted Content, and Events). Another option is to use pages on the same site (assuming you need to share lookup lists or there is some specific reason you can't use separate sites) and rather than have a different theme for each element, use unique imagery to differentiate the concepts. You could use a consistent header image and overlay text for assets or content that go together to get the outcome you are looking for. I wouldn't let colors or theme drive a decision to use a legacy architecture structure when there are other ways to get that outcome without the dreaded "s" word!
@Susan Hanley thank you - however the site doesn't have a requirement for News, Highlighted Content or Events..

I've tried the different layout methods as you mention, however it will not solve the issue if one area (subsite) needs to have a purple theme, another a red and the other a blue.

The main purpose will be a document search.
Did you try pages where the banner image was simply a color block - purple, red, or blue? You can put the different doc libs on pages with the banner color and it will pretty much look like the site has a theme! If you need buttons in different colors, use the Call to Action web part and use the same color block (I make one-color images in PowerPoint all the time for this purpose) as the background image and you have a button in a unique color. If you don't need any of the other features, I would hate to see you go to subsites just for this one non-functional reason. But, if the users won't budge, it doesn't have to be the sword you fall down on!
@Susan Hanley the call to action might be an idea that works - is there a way to remove the black background to the text though?
No, but you don't have to use the "call to action text" part. The background isn't actually black on the hyperlink part - just on the text. If you don't add any text, it won't show up when you publish. The hyperlink in that web part, however, is the color of your primary theme - so you want to be sure that the colors you are using for each "function" are part of your brand palette or the experience will look bad.
@Susan Hanley - thanks, however I need to put text of the images also