Using the SharePoint Content Editor Web Part for Centralized Content
By: Rob Fisch | Updated: 2011-01-04 | Comments | Related: > Sharepoint
I would like to be able to centralize a message and be able to roll it out to multiple SharePoint sites simultaneously. When the message changes, I only want to edit one section and have the changes roll out everywhere automatically.
Using the Content Editor Web Part, we can use a special feature called the "Text Link". This allows us to link to any text file in an accessible location. Thinking about this as a front-end/back-end architecture, the "back end" source data will live in a text file. The "front end" will be one or more SharePoint "Content Editor Web Parts" on a (home) page of any number of SharePoint sites. When the source text is updated, all of the linked Content Editor Web Parts will display the new text automatically and seamlessly.
Let's see how this works.
(Note: This example uses SharePoint 2010, but the same concepts apply to MOSS2007, WSS3 and WSS2.)
First we need a place to store the text file. Before proceeding, create a new document library or use an existing one. While not required, this should probably be in the root site of your site collection;
The "Text Link" can use any text format (i.e. .txt, .html, even .aspx). For this example, we will use an HTML file. The html can be created with any editor. In this case we will use SharePoint Designer. (This is a free download from Microsoft.)
With SharePoint Designer installed, click on "Site Actions", then "Edit in SharePoint Designer". (SP 2010 only, for MOSS2007/WSS3/WSS2 you will need to open SharePoint Designer separately or use another editor.)
Under "Site Objects", click "All Files". Then click on the desired document library. (I am using one called "sitedocs" that I created.)
Once the library is opened, RIGHT-click into the white space under "Forms", then select "New" and then "HTML".
Give your html file a meaningful name.
Once named, click the file. This will open a general properties menu page. Click on "Edit File".
Type your message and save the file.
Back in the library, RIGHT-click on the file in the library and select "Copy Shortcut". Paste the URL temporarily into a text editor (i.e. Notepad.exe).
Back on the home page of the site, click the "Page" tab and then "Edit Page".
Click "Add a Web Part".
Under "Categories" choose "Media and Content", then under "Web Parts" select˙ "Content Editor". Then click the "Add" button.
From the web part menu (down pointing black triangle), select "Edit Web Part".
In the field that says "To link to a text file, type a URL", paste the URL of your Content Message. If you prefer, you can click the elipsis (3 dots on the right) see paste or review the entire URL. Once the URL is entered, click "OK".
Click the "Stop Editing" button.
Review the message you created in the HTML file. This is now on the home page of the site.
You can now repeat the process of pasting the URL into any number of Content Editor Web Parts on different sites.
When you edit the source (HTML) file, all sites with the Content Editor Web Part text link will automatically update the content of the message!
- Check out these other SharePoint tips
Last Updated: 2011-01-04
About the author
View all my tips