Forum Discussion

Kateraid's avatar
Kateraid
Brass Contributor
Jun 26, 2019
Solved

Unable to add custom template to a new modern site connected to a modern Hub

I am using a modern hub site collection in Office 365 Online & I am the 365 admin. I am trying to create a new site (within my hub collection) and want to use a custom site template and need help. 

At first I didn't have the option to upload a site template - under Site Settings>Web Designer Galleries, the Solutions option wasn't there. I used a PowerShell command to add this back in. So now I have uploaded my site template to the primary Hub site, but I can't find a way to use it for anything other than a sub-site. We're trying to avoid sub-sites (per Microsoft best practices). I typically create new sites for the hub using the SharePoint Admin Center - In the Active Sites window I click Create... but there's no option here to create a 365 Group site using a custom template. 

 

Are custom site templates only supported in hub collections if you build a sub-site? Does anyone know if there's a way to use a custom template with a modern hub site (not sub-site)? 

 

  • Well folks, I answered my own question thru much trial and error, so I am posting what I did to fix this. 

    1. Used SharePoint Admin center's classic experience to enable custom scripting at the tenant level
      • This is not yet avail in the modern, so you have to switch back to classic temporarily for this
    2. Used this https://sharepoint.handsontek.net/2018/10/28/enable-custom-script-on-modern-sharepoint-sites-using-powershell/ to allow custom scripting on the Hub collection's primary landing site.
    3. I used most of https://sharepointmaven.com/how-to-create-sites-and-site-collections-from-a-sharepoint-site-template/ to load the template and create the site       PMdevTestSiteCollection01.
    4. After finishing the HOW TO CREATE A SHAREPOINT SITE COLLECTION FROM THE SITE TEMPLATE instructions, I switched back to the SharePoint Admin center's modern experience and edited the Hub site association to align it with my modern hub. 

    This is a modern project site, connected to a hub collection in 365 online using the a custom template! Woo-hoo!!

     

    The Hub navigation top bar is not on every page of the site, and the Quick Launch is being weird, closing menus inconsistently… but the bulk of the webparts that I wanted from the template have been applied. The page edit features seem to be a mixed bag of classic and modern, likely b/c the template was created in the classic experience.  I'm not sure there's a way to edit the Hub navigation easily in the new project site's landing page's interface. There is likely a way to do this in PowerShell or JavaScript I'm guessing. 

     

    If I'm worried about security & leaving allowance for the custom scripting, I can turn all of that back off. At the tenant level I can do this in the SP Admin Center classic experience. At the site level I can run some PowerShell code to turn it off. I believe the custom scripting only needed to be enabled to allow the template to apply during site creation.

     

    This is definitely connected to a modern Hub site collection according to the SP Admin Center. Parts of it feel classic and parts of it feel modern. It's like a hybrid site. I did some hub level searching on my Hub's landing page and it pulls data in search queries seamlessly out of the hybrid site. Some of the pages have a modern feel including the Hub top link navigation and the edit tools are modern.

     

    This is definitely a site collection and not a sub-site, because /sites/ is in the URL

     

    The only thing that's a bummer and I will have to research more is this hybrid site doesn't have an Office 365 Group alignment. I don't see an easy way to edit this. It might require Power Shell. 

     

    Kateraid 

1 Reply

  • Kateraid's avatar
    Kateraid
    Brass Contributor

    Well folks, I answered my own question thru much trial and error, so I am posting what I did to fix this. 

    1. Used SharePoint Admin center's classic experience to enable custom scripting at the tenant level
      • This is not yet avail in the modern, so you have to switch back to classic temporarily for this
    2. Used this https://sharepoint.handsontek.net/2018/10/28/enable-custom-script-on-modern-sharepoint-sites-using-powershell/ to allow custom scripting on the Hub collection's primary landing site.
    3. I used most of https://sharepointmaven.com/how-to-create-sites-and-site-collections-from-a-sharepoint-site-template/ to load the template and create the site       PMdevTestSiteCollection01.
    4. After finishing the HOW TO CREATE A SHAREPOINT SITE COLLECTION FROM THE SITE TEMPLATE instructions, I switched back to the SharePoint Admin center's modern experience and edited the Hub site association to align it with my modern hub. 

    This is a modern project site, connected to a hub collection in 365 online using the a custom template! Woo-hoo!!

     

    The Hub navigation top bar is not on every page of the site, and the Quick Launch is being weird, closing menus inconsistently… but the bulk of the webparts that I wanted from the template have been applied. The page edit features seem to be a mixed bag of classic and modern, likely b/c the template was created in the classic experience.  I'm not sure there's a way to edit the Hub navigation easily in the new project site's landing page's interface. There is likely a way to do this in PowerShell or JavaScript I'm guessing. 

     

    If I'm worried about security & leaving allowance for the custom scripting, I can turn all of that back off. At the tenant level I can do this in the SP Admin Center classic experience. At the site level I can run some PowerShell code to turn it off. I believe the custom scripting only needed to be enabled to allow the template to apply during site creation.

     

    This is definitely connected to a modern Hub site collection according to the SP Admin Center. Parts of it feel classic and parts of it feel modern. It's like a hybrid site. I did some hub level searching on my Hub's landing page and it pulls data in search queries seamlessly out of the hybrid site. Some of the pages have a modern feel including the Hub top link navigation and the edit tools are modern.

     

    This is definitely a site collection and not a sub-site, because /sites/ is in the URL

     

    The only thing that's a bummer and I will have to research more is this hybrid site doesn't have an Office 365 Group alignment. I don't see an easy way to edit this. It might require Power Shell. 

     

    Kateraid 

Resources