Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Is it possible to set the default page of a publishing site, to the first page in Pages library?

share|improve this question
add comment

3 Answers 3

up vote 0 down vote accepted

There is no OOB option do this. First page in pages library is kinda relative, based on the default sort (by name , created date...etc). In SharePoint 2010 its just a single button click on the Ribbon, do evaluate the option before any custom implementation

Custom Solution:

  1. Create a event handler for Item Updated event
  2. Write a CAML query to list all published pages as per the sort logic ( Title, modified date..etc)
  3. Make the first page as default
share|improve this answer
    
thanks for the answer, by the way something came to my mind, do you think is it reasonable: i can prepare an aspx page to make the site's default page, in the code behind, i find the pages library and items in it with SPContext, then Response.Redirect to that page. Or i can develop a user control (ascx) which do the same thing above(redirection), and i can place it in the default.aspx? –  ozdogan Oct 8 '12 at 14:53
1  
Can be done, but Homepage loadtime is very crucial for any site; this code will be executed every time the default.aspx is loaded for every user and can lead to performance issue. –  Vamsi Oct 8 '12 at 15:02
add comment

In the page that you want as default click the "Make Homepage" icon in the "Page" tab in the ribbon.

enter image description here

share|improve this answer
    
But this process must be automatic, in every subsite created. I cannot tell content-authors to do what you have said. –  ozdogan Oct 8 '12 at 14:32
add comment

If you are looking for a non-developer solution then you might be able to do this with a PowerShell script that would iterate through the various sites, find the right page and tag it as the welcome page. It would naturally take a little bit of work to get it working exactly how you want. You could then set it as a scheduled task to run daily (or whatever makes sense given the content and frequency of changes) so that newly created sites would also get their welcome pages set.

This is not an ideal solution, merely a workable one. For a "Real Solution" to this, you would probably need a feature along the lines of what Vamsi proposes where it would do the above work upon activation and then hook into site creation via either stapling or the WebProvisioned event so that all future sites would get this treatment as well.

share|improve this answer
    
hi dave, actually non-developer solution is not a must for me. i can develop. but i am looking for the best and optimal solution –  ozdogan Oct 8 '12 at 16:45
1  
In that case, I would recommend the second paragraph above. Fire up Visual Studio, create a new SharePoint project and add the code required to iterate through the site collection part of the FeatureActivated event. Then hook into the WebProvisioned event for each web and have it also run the setWelcome logic for just the new site - and hook into that site's WebProvisioned event as well (if needed). This might help : digsharepoint.blogspot.com/2012/03/… –  Dave Wise Oct 8 '12 at 17:06
    
So you are suggesting to write an event receiver for site creation. But, as the time site is created most probably there will be no pages in Pages library. After the site is created, content authors will create pages. So dont you think it is better to write an event receiver for Pages library and itemCreated event. –  ozdogan Oct 8 '12 at 17:20
    
If that is your situation, then yes. However, when a new publishing site is created its /Pages/ library already contains a single page and that page is the welcome page, by default. With that in mind, I wasn't entirely sure where your specific need was coming from. –  Dave Wise Oct 8 '12 at 17:24
    
I can explain the requirement: I have several levels of subsites. In the leaf level subsites which are publishing sites, there are for example, product or campaign sites. In these sites content authors are creating content as pages. And each page has rich text content. At these sites, i donot want any empty default.aspx, that is the welcome page of the site. For example, in a subsite, there are pages created like these, General info, Prices, FAQ, Further Details. Users of the sites are displaying these pages. –  ozdogan Oct 8 '12 at 17:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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