Unexpected error when change page layouts

Problem:

Recently, our intranet has been renamed from gw to g10. With this change, some pages receives an unexpected error when changing the page layout.

Unexpected Error

I opened the site in SPD and tried “Detach from Page Layout”, threw the following error

 

 

question

After searching on the net, this article talked about the same problem and provided some power shell code to solve it. There were some drawbacks of this solution discussed in the comments section. So I didn’t take this approach. Another article really helped me. Thanks to the person who shared the problem and the solution.

Solution:

  1. Open the site which contains the page that had error in SPD.
  2. Go to All Files ->Pages->highlight the page that didn’t work.
  3. From the top ribbon, select Export File. Save to a location where you can find later on.
  4. Right click on the exported file and open in notepad.
  5. Ctrl + F and search for “_catalogs/masterpage/DefaultLayout.aspx”. You should only find one result and notice that link pointed to the wrong domain.
  6. Change the domain to your current correct domain and Save.
  7. Copy the file back to SPD, overwrite the existing one.
  8. Go back to the browser and change a page layout. It works!

 

Advertisements

Page Layout dropdown is not showing on edit mode

When I edit a page on a publishing site, I don’t see the dropdown list when I click on the Page Layout button from the ribbon. After searching on Google, I found two possibilities:

  • Don’t have enough permission
  •  SharePoint ribbon tries to load unexisting content and thus errors and cannot show the dropdown.

I checked my permission and got full control. Also noticed that for users who don’t have enough permission will simply have the Page Layout button greyed out. But for me, the button was still clickable, just no dropdown.

Found out that when the site was copied across from another site using 3rd party software, my customized content type didn’t get copied across. Therefore, its associated page layout couldn’t find the content type.

So I created the content type in SharePoint Designer:

  1. In the Navigation Pane, click “Content Types”
  2. From the ribbon, in the New section, choose Content Type
  3. Enter Name, Description.
  4. Parent content type from: Publishing Content Types
  5. Parent content type: Page
  6. Create a new group, e.g. My Custom Group
  7. Click OK, and you are finished with creating a content type in SPD.
  8. Go to the browser, Site Actions->Site Settings->Galleries->Master pages and page layouts->Select the page layout and Edit Properties
  9. Content Type: Page Layout
  10. Associated Content Type: Content Type Group: choose the group you created in step 6 Content Type Name: choose the content type you created in step 3
  11. Save and done!

Hide navigation nodes from showing in search result

When searching a term in SharePoint 2010, the result returns pages that doesn’t contain the term but it’s nested sub pages has the term. For example, the “Science” page which doesn’t contain the word “carbon” but it has a sub site called “Carbon” which contains the word “carbon”. When searching “carbon”, both the “Science” page and “Carbon” page gets displayed in the result set. To hide the top level pages which doesn’t contain the searched term from the result set, the following code needs to be added to both the global navigation and quick launch divs.

class = "noindex"

Reference:
http://www.matdesmarais.com/2011/12/sharepoint-2010-excluding-navigation-nodes-from-search-crawl/

http://www.dotnetmafia.com/blogs/dotnettipoftheday/archive/2011/01/26/how-to-exclude-part-of-a-page-from-being-indexed-by-sharepoint-search.aspx

Custom rich text editor styles for Content editor web part

I need to restrict site editor not to use OOTB fonts and styles while they edit the contents of “Content editor web part” in SharePoint 2010.

I created custom text styles and added these styles to my custom page layout’s style sheet only. So if an editor creates any page using my custom page layout, he/she will only see custom text styles while editing the “content editor web part” contents.

This article was very helpful!

In his first step, he added the css to the whole site’s master page’s css. I added these css to my layout’s css instead.

Change orgnization spelling with “s” in My Orgnizational Chart

Recently, I’ve been involved with customising our company’s MySite 2010. One of the requirement is to change the word “Orgnization” appeared on the person.aspx page to have a “s” instead of “z”.

To change the tab, I went to Site Actions-> Site Settings -> Under Look and Feel -> Quick launch, click the edit button next to Orgnization to change it.

To change the My Orgnizational Chart web part, edit the page, edit the web part, change the title of the web part.

In the My Orgnizational Chart web part, down the bottom, there is a link called “Orgnization Browser”. I had to change this one using the following jQuery. The jQuery is added to MySite.master page, inside the head tag.

<scripttype="text/javascript"src="/_layouts/MySiteExtensions/jquery-1.8.3.min.js"></script>
<!--The following jQuery changes the spelling of "Organisation Browser" in the My Organisation Chart web part on Overview page-->
<scripttype="text/javascript">
        $(document).ready(function () {
            $('#ReportingHierarchy')
                .siblings('table')
                .find('a')
                .html('Organisation Browser');
        });
</script>

Reference:

http://social.technet.microsoft.com/Forums/en-US/sharepointadminprevious/thread/dfda5356-bda9-44e0-9a5b-37c68f669174?prof=required

http://social.technet.microsoft.com/Forums/en-GB/sharepointadminprevious/thread/ad6d9796-8823-468a-955f-68ff84f1d538 (The reply marked as answer didn’t work, the jQuery reply may work, but haven’t tried)