1

I have created a news post and saved it as template on a modern communication site. Is there an option to reuse the template while creating news posts on the subsites as well? Any pointers on this is appreciated. Thnaks

1

It is possible to just copy the Template files from /SitePages/Templates folder to all subsites.

However, there are some limitations

  • We must manually create at least one page template on the target subsite. This will trigger some internal process that will make tempaltes work. Otherwise, your copied templates will remain ignored. Good news is that you need to do it only once per subsite.
  • You need PowerShell PnP version: 3.12.19 or later

PowerShell PnP Code to copy all site templates from the root site to all subsite within site collection

    # Need new PnP version: 3.12.19 or later
    Install-Module SharePointPnPPowerShellOnline 

    # Make sure PnP version is 3.12.19 or later
    Get-Module SharePointPnPPowerShellOnline -ListAvailable


    # Ensure 'Templates' folder exists on all sub sites: 
    Get-PnPSubWebs -Recurse | % {Resolve-PnPFolder -SiteRelativePath "SitePages/Templates" -Web $_ }

    # Get All Page Templates:
    $PageTemplates = Get-PnPFolderItem -FolderSiteRelativeUrl '/SitePages/Templates'

    #Download all Page templates:
    $PageTemplates | % { Get-PnPFile -Url "/SitePages/Templates/$($_.Name)"  -Filename $_.Name -AsFile }

    # Upload Page templates to all subsites of the current site collection
    $subwebs = Get-PnPSubWebs -Recurse
    foreach ($subweb in $subwebs){
        Write-host Processing $subweb.Title
        Get-ChildItem -Filter "*.aspx" | % { Add-PnPFile -Web $subweb -Path "$(Get-Location)\$($_.Name)" -Folder "\SitePages\Templates" -Publish }           

        # TODO:
        # Subsite needs at least one Page tempalte saved manually. Otherwise our moved tempaltes won't show up.
    }

enter image description here

enter image description here

enter image description here

0

The news post templates are stored in the current site "Site Pages" library, we cannot use this template on subsites.

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.