Add a WebPart to a publishing page layout - sharepoint

I've been trying to figure out a way to add a web part onto a page layout. Whenever I try to add a web part zone or web part via the menus in SharePoint Designer, nothing happens. The web part I selected is highlighted blue, but nothing happens.
I have been trying to add the .webpart code on the .aspx page layout with zero luck.
<WebPartPages:WebPartZone>
<ZoneTemplate>
.webpart code in here!
</ZoneTemplate>
</WebPartPages:WebPartZone>
The above just shows the web part zone, and the ability to add a web part, but doesn't show my web part.
I've tried placing the code outside the Zone Template and the WebPartZone, but I typically just get everything between the property tags displaying as text.

You cannot add the codes to get your webpart embeded on a page , you have to open the page layout in a designer and drop the webpart on that specific area - there may not be anyother work around for this
Regards
Arjun

SharePoint was not updated to support creating the snippet of code to add the WebPart to the Page Layout like it is possible with old fashioned WebParts.
Even when inserted in the Page Layout .html file, it is stripped out when the corresponding .aspx file is generated.
We found a workaround which is far from ideal but works:
Edit your Page Layout as you would normally in HTML
Add a WebPart zone where you would like to see the WebPart
Save the HTML and let SharePoint generate the aspx file
Manually edit the aspx file -- don't use SharePoint Designer, as it will strip out what you added -- with a plain text editor and insert the code from the webpart definition (the XML file)
Save the aspx and when you create a page using the page layout, your SPFx webpart should be there
Note that for the WebParts parameters, it is stored as a JSON structure encoded in HTML. To figure out how to setup default parameters in the inserted WebPart, insert it into a regular page manually and look at what has been generated in the aspx file. Then find the long line that has the encoded JSON structure and copy it back to your edited aspx file.
Finally, never edit/save your page layout HTML file since it ewill then simply override your changes. I would keep a copy of your edited aspx file just in case!

It sounds like you're trying to use a Visual Web Part with SharePoint Online, which you can't do. Web parts for SharePoint Online need to be packaged as a part of a solution.
To deploy a solution to SharePoint Online you need to:
Navigate to the solutions gallery: https://<yourfarmsite>/catalogs/solutions/forms/allitems.aspx
Providing that you are logged in with the correct account and have permissions, this will take you to the solution gallery, where you can upload and activate custom web parts for site.
Click the Solutions Menu
Click Upload Solution
Browse to your custom .wsp file and click OK
After the web part has been uploaded, you can activate it; select the web part and click Activate
Now that the custom web part is uploaded and activated in the Solution Gallery, you can edit the site page that you want to add it to and then add it as per a normal web part.

Related

How to edit a page in the SharePoint?

I have some custom codes in form of HTML which I wanted to add to the SharePoint. I find out there are two ways to do it, one is using the SharePoint Designer and the other one is uploading the page. However, this is local SharePoint in my Windows Server and I want to modify the page locally because I have limitation when using the Designer and Upload page. I also don't want to add a new page and I would like to modify the current page using my own code.
Are you able to help me out?
Edit the page> insert the Embed Code web part to add custom HTML codes:
More information for your reference:
https://www.c-sharpcorner.com/blogs/how-to-add-html-page-to-sharepoint-site

SharePoint content editor web part is missing the url to HTML file in edit mode

This is a weird one, but I am not sure if I am missing something here. There used to be a location for the link to HTML files in content editor web parts. I cannot find the url now! I want to know which HTML file the web part is showing at the moment so I can modify it. It not under any of these: Appearance, Layout, Advanced.
The problem was SharePoint Online's content type editor had gone missing. So I managed to enable the feature back on again. As soon as I enabled the feature, the content editor edit panel went back to its previous status. I used this to do it:
Content Editor Web Part missing on SharePoint Online

SharePoint 2013 online customize personimmersive page

I want to customize the SharePoint 2013 online(office 365) "About me" linked page (personimmersive.aspx) to a custom look and feel.
Even clicking on any SPUser name, for ex in a list item modified by is "John Smith" if we click on it goes to about me page.
This page resides under mysite but I cannot see this page is SharePoint 2013 designer to edit, but modifying SharePoint pages in designer is not always the best way.
Can I just create a new page and redirect all Profile page request to that custom page?
IF I create app parts and edit the page I cannot edit the top portion of the page.
redirecting may not be a feasible approach, specially on the online versions
you can try to take advantage of web parts and css to do what you can
The biggest change is that you can’t edit the entire top portion of
the page. These used to be in a web part zone, and you could choose to
add/remove the web parts. Now they are fixed, with no ability to move
them around or change the parts.
We had removed the Activity Feed web part previously because we were
using Yammer newsfeeds and group feeds embedded throughout the site,
and this part always showed “No activities”. Now this is back again,
with no way to remove it, short of editing the page in SharePoint
Designer.
There are still web part zones on the bottom, but really the problem
is no control over the display of most of the top of the page.
http://weshackett.com/2014/04/office-365-new-profile-page/
There is personImmersive.aspx in SharePoint Designer, you should be able to find it in All Files. Just make sure you connect to [your_domain]-my.sharepoint.com instead of [your_domain].sharepoint.com.
you can't customize the page completely.However you can add custom web part and custom css to change the look and feel to a great extent.
#tiago duarte you can still remove the activity web part.This can be done using script editor webpart and hiding the complete block/div.

SharePoint 2010 Content Editor Webpart not supporting iframe

I am trying to Embed a SharePoint Site Page in a Content Editor Webpart using iframe in SharePoint 2010. Once i save and close the content editor, the iframe is removed. Is there a solution for this?
The Content Editor Web Part is intended for adding HTML content to a Web Part Page, it is not designed to link to a Web site. If you need to link to a Web site, consider using the Page Viewer Web Part. -Microsoft-
refer this link.
Not sure if this can help you, but I wrote a blogpost about embedding videos like iframes into Rich Text fields.
In short its a script you add to your page through a Content Editor Web Part and after that the users can simply paste the iframe code directly into the rich text field and the content will show.
You could also embed the script into your masterpage.
Anyway, have a look at it and maybe you can modify the script to your needs
Embed video using script

Is it possible to put a Content Editor Web Part in a sharepoint app page

Is it possible to put a Content Editor Web Part in a sharepoint app page along with the ability to edit the web parts contents from the browser? In other words have it behave as it would on a web part page.
I can get the web part to show but I have no clue if it can be setup for in browser editing on the application page ... I can't get it to show the edit button.
Jay
You can put a Content Editor WebPart on an application page because it's just a special kind of web control, but there is no web part manager on the page and even if you added one it would not have a record in a content database for the page. So it would not know where to store the information.

Resources