5

In the standard library for site pages I would like to configure a template for the content type "site pages".

In the settings menu under library settings -> list content type -> advanced settings there is a option "Template: Specify the document template for this content type.".

By default the path "/_layouts/15/CreateSitePage.aspx" is in there.

Is it possible to use a different site page template there?

On the start page there is a template that I have created. But I only get this for selection if I open the "new menu" from the start page and select page. Then a mask opens and I can choose my own template. If I'm in the standard page library for site pages, I can choose the content type:

  • Site page <----Here I would like to set my template.
  • New provisioning page
  • Wiki page
  • Web page

Users should simply get this template open when they click on "Site page" in the library.


My failed attempt: I simply uploaded as a document template the template (.ASPX page) I created in my website library and which is selectable on the start page. After I uploaded it and updated the page, the file name of my template is now in this textbox:

template

But when I now try to create a new "Websiteseite" via the "New menu", I get the following error:

Object reference not set to an instance of an object.

Korrelations-ID: c2cf319f-1086-9000-7bf6-32992696fc1b

When I click on "Edit Template", I get the following message: "Edit Document requires a Microsoft SharePoint Foundation compatible application and Microsoft Internet Explorer 7.0 or higher".

4 Answers 4

0

I’m afraid it is not possible.

I tried to use a URL to a modern site page template under “Enter the URL of an existing document template”, but instead of using the template, it just open the page or the template when clicking New > Site Page.

My guess is that to change the default template, we will need to replace the CreateSitePage.aspx with a custom template in the 15 Hive folder. However, the folder is not accessible for SharePoint Online.

If we upload a custom page or a page template, it leads to the error “Object reference not set to an instance of an object.”

4
0

This is because the Site Pages library still uses Content Types. The other 'New' menus on the start page and from other pages don't, they use the new page templates functionality. Reading between the lines, if MS haven't implemented a consistent 'New' menu option for pages in the Site Pages library it's maybe because content types for site pages are going to go away or change dramatically in how they are managed via the new Content Service admin center.

This is likely to be the best option in the short term for deploying page templates: https://mattipaukkonen.com/2020/07/02/distribute-sharepoint-page-templates-with-pnp-powershell-and-provisioning-templates/, then inform your users to not create pages from the library menu.

0

I found a solution that worked for me:

Default: /_layouts/15/CreateSitePage.aspx

Solution: /_layouts/15/CreatePageFromTemplate.aspx

Now, you can choose your specific template.

1
  • Thank your very much! I will try it and mark this answer accordingly after that Mar 18, 2022 at 12:38
0

I can confirm the finding that this currently does not work in the expected way. I also tried @Sebsation Münz' answer and it did not work for me.

I used the following unsatisfactory, yet usable workaround:

  1. Create a site page from your custom page template and save it as "Wiki-Page-Template.aspx". Let's call it base page.
  2. Link it in the reference text box of the custom content type as such: /sites/<siteName>/SitePages/Wiki-Page-Template.aspx
  3. The user can now use this base page as a makeshift template via New -> Copy of this page enter image description here
  4. Step 3 can be added as a user instruction to your base page.

I assume you have a custom view that shows a list of all wiki pages. You can exclude Wiki-Page-Template.aspx from it by applying a filter to the custom view that excludes files with this exact name.

Beside the subpar user experience, another disadvantage of this solution is that you will need to maintain both the actual template as well as the base page in parallel.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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