I need to copy news templates from one modern site to many others, automatically. I soon realized that the template newspages is stored in Sitepages/Templates on a site.
Using PNP Copy file I can copy the template files to any site I want:
Connect-PnPOnline -Url "https://contoso.sharepoint.com/sites/DevTemplate"
Copy-PnPFile -SourceUrl "Sitepages/Templates" -TargetUrl "/sites/Dev_Test21/Sitepages" -OverwriteIfAlreadyExists -Force
Now to the issue, when I copy the files to a new site with newsfeed, I cannot use the template pages that I copy. They just wont show up even if the Template folder is there with items in it.
If I then manually creates ONE template ("ik" on pic below), the copied files also shows because they are in the Sitepages/templates already. It's like I need to create one manually to enable the template function at all.
Any ideas or anyone who managed to copy Sharepoint news templates between sites?