How to embed SharePoint 2013 web pages directly into an aspx layout page as the default websites for that layout

I am using SharePoint 2013 and have a dedicated master page and several aspx layout pages, all of which need to be expanded, copy them to the Master Pages and Page Layouts section under Site Settings.

These aspx pages contain web part zones, but how can I add the web part to the markup of the aspx page in the web part zone?

What I'm essentially trying to do is inject the "Default" web pages into the page layout so that when that layout is selected for a specific page, it has already added web pages to it.

I'm talking about individual websites, such as Content Editor and Document Library Web Pages. In 2013, they are all now known as "Applications".

Any suggestions that were much appreciated.

+3


source to share


1 answer


The easiest way is to use the constructor to generate the code for you ...

  • Create a page and open advanced mode in SharePoint Designer.
  • Add the required web page to the web part zone. This will create the required html.
  • Copy it and remove g_ from the ID value.
  • Use this code in your page layout.

Ps: Id the WebPart button is disabled in the SharePoint designer ribbon, just save the page. This will allow you to do this.



The code generated by the designer when adding the Content Editor Web Part and the Script Editor Web Part is shown below.

<WebPartPages:ContentEditorWebPart webpart="true" runat="server" __WebPartId="{BA190D08-907A-4F94-B8F0-C3966A61E601}">
    <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
        <Title>$Resources:core,ContentEditorWebPartTitle;</Title>
        <Description>$Resources:core,ContentEditorWebPartDescription;</Description>
        <PartImageLarge>/_layouts/15/images/mscontl.gif</PartImageLarge>
        <PartOrder>4</PartOrder>
        <ID>ba190d08_907a_4f94_b8f0_c3966a61e601</ID>
    </WebPart>
</WebPartPages:ContentEditorWebPart>

<WebPartPages:ScriptEditorWebPart runat="server" ChromeType="None" Description="$Resources:core,ScriptEditorWebPartDescription;" 
    ImportErrorMessage="$Resources:core,ImportErrorMessage;" Title="$Resources:core,ScriptEditorWebPartTitle;" 
    __MarkupType="vsattributemarkup" __WebPartId="{1861cebe-9134-4645-8500-13ce8817d416}" WebPart="true" 
    __designer:IsClosed="false" partorder="6" id="1861cebe_9134_4645_8500_13ce8817d416">
</WebPartPages:ScriptEditorWebPart>

      

+7


source







All Articles