0

I have some HTML that I would like to display on several web part pages, without having to copy the content to each web part page. I want to be able to edit this common content in one place and have the changes reflected in all web part pages that use it.

Is this possible?

N.B. I am a SharePoint user, not a developer, so I have no access to SharePoint designer or any other coding tools. I'd need a method that can be applied in the standard web interface.

7 Answers 7

2

You could also use jquery to load the content of an HTML file in a library to a content editor web part.

1
  • I think this is the only universal solution if you have any desire to allow people to view your pages on a mobile platform. SharePoint will detect if you are trying to view a Content Editor Web Part on a mobile platform and will refuse to render it. You need to delay loading the html as ps_md recommends. Keep in mind that with something like Bootstrap 4, you should be laying your pages out for mobile first and then using the reorder attributes to shift the columns around for the desktop dimensions. Together, these techniques should give you the most coverage for your money.
    – Newclique
    Commented Feb 11, 2019 at 18:02
0

You can render an HTML page by using a Page Viewer WebPart, which loads another page in an iframe in your browser. If you add the Page Viewer WebPart to each page you want to display it on, you can serve the same HTML file without having to duplicate the content.

See Display a Web page on a SharePoint page by adding the Page Viewer Web Part for more information.

2
  • Does that have to use a raw HTML file that I write myself or is there a way to do it using just a "Basic Page" that I can edit using the SharePoint rich text editor?
    – jl6
    Commented Oct 24, 2013 at 15:59
  • You can, but you'll get the whole page, not just the contents of the page. This means your frame will show the ribbon, left nav, etc. unless you add CSS to the branding of your site to prevent this (hide them with rules like "iframe #theElement { display: none; }"). Commented Oct 24, 2013 at 17:01
0

I would use a content editor web part that refers to a text file containing the html. It is called "content link". You add the web part, place the text file on your server and enter the URL into the web part properties.

http://office.microsoft.com/en-us/help/content-editor-web-part-HA010024046.aspx

0

In order to do that without any customization, Please create your desired HTML and upload file containing your desired HTML into sharepoint then you can add content editor web part to all of your pages you want to share you common HTML content. In all of you content editor web parts provide link to that HTML file and I will display that HTML to all pages where ever content editor web parts are referring to that file. More over if you change your html in future that change will be automatically reflected in all those pages.

0

If you're using a publishing site, under All Site Content, there should be a list called Reusable Content that exists for exactly what you're trying to do. If you can't get your administrators to use a publishing site, you're stuck with using a Content Editor Web Part linking to an html file saved somewhere on your site. To create the html if you're not comfortable creating it from scratch, follow these steps:

  1. Create a library named Site Assets (if you don't already have one). Under list settings, Advanced Settings, set "Should this document library be a site assets library?" to Yes.
  2. Create a content editor web part with the content and formatting you want, and copy the html from the rich text editor.
  3. Open notepad and enter the following code:

    <html><body>

    </body></html>

  4. In the space between the <body> tags, add the html you copied from your rich text editor.

  5. Save the file by naming it filename.html and selecting "All Files" from the "Save as type."

  6. Upload the new html file to the Site Assets library and reference the file URL from your content editor web parts.

0

The easiest way is to insert a Script Editor to your page (Add a web part > Media & Content category > Script Editor)

You can literally copy & paste the html you have and even export it and re-use it as many times as you want.

0

You can create the content in a Content Editor Web Part, then do the following to move it to other sites:

  1. Edit the page (if you haven't already set it to edit).
  2. Click on the little carat/arrow above your content editor web part to open its menu.
  3. Click on "Export..." and save it to your computer.
  4. Open up another page you want to use the data in and open it for editing.
  5. Click on "Add a Web Part".
  6. Down at the bottom of the "Add a Web Part" pane you'll see a place where you can upload files.
  7. Click on the carat, click "Browse..." to choose your file, and then click on "Upload".
  8. This closes the web part dialog but then you just click on "Add a Web Part" again and you should see your imported web part as the only item on the web part pane.

Your Answer

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

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