I’d like to add some templates to the wiki site collection. These predefined with headings and or topics to structure the page. Reusable content is usable on some occasions but I’d like to support giving predefined choices for page layouts when a new page is created. Any suggestions?
Hi Susan,
Is this an enterprise Wiki (ENTERWIKI#0) site?
Is your site On-premise or SP Online as this will affect the solution design (server side, client side, app)?
I believe that Wiki pages behave slightly differently to publishing pages (http://sharepoint.stackexchange.com/questions/70529/create-a-new-wiki-page-using-the-2013-client-library), but have not tested this. In any case, here are some suggestions based on plain publishing pages, which may be adapted for Wiki pages.
– List of templates
Use existing pages in the site (Pages library) as as your templates. This will allow you to actually create and edit the templates using the OOTB UI. Use a custom content type to identify the template pages. Hide these pages from the default view somehow.
or, Use a custom list that defines the templates with relevant metadata.
– Navigation
Create a custom ribbon icon in the Pages library “Create from template” that fires up a custom page that hosts your UI
and/or, create a link on the home page to the custom provisioning page
– User Interface
Content editor web part HTML & javascript
HTML:
– file name
– title
– template to use (dropdown)
JavaScript
Retrieves the list of templates available.
Validates input.
Creates a new publishing page.
Sets properties on the new page based on the same properties in the template (or specific hard-wired properties – simpler).
Possibly then redirects to the new page so that the user can edit other properties.
Some useful links for this approach:
http://msdn.microsoft.com/en-us/library/office/jj954470(v=office.15).aspx
http://sharepoint.stackexchange.com/questions/92910/setting-page-layout-using-jsom
http://social.technet.microsoft.com/Forums/office/en-US/95ca3f5d-06e8-479e-8f47-1115f91e0134/adding-wiki-page-client-object-model?forum=sharepointdevelopmentprevious