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

I've created a MOSS 2007 SharePoint site definition for my users, and now want to use a custom default.aspx page as a landing page every time a new site using that definition is created. That default web page needs to display some web parts pointing to site relative data e.g. I want it to display some documents from a local document library on the site.

I've opened a site in SPD and modified the current default.aspx page by adding a web part pointing to the document library. However, the links in the code point to the library on the site I'm looking at in SPD. How do I save this page as a template so that it points to the local library whenever it gets deployed to a new site? Is that even the right way to do it?

I've got the core publishing feature activated if that helps, although this is not a publishing site so doesn't have the full range of publishing options.

share|improve this question

migrated from stackoverflow.com Jun 21 '11 at 19:12

This question came from our site for professional and enthusiast programmers.

1 Answer 1

You'd do this using a feature. Save the page to your machine, then create a solution using Visual Studio (and say WSPBuilder) that deploys the page to your site. It'll overwrite the existing page. The only problem is that most standard webparts reference lists using their id (a Guid), so you'd need a way to circumvent this. I usually do this by adding a feature receiver to the feature, which allows you to use the SharePoint Object model to perform actions in code.

P.S. more info here: http://social.msdn.microsoft.com/Forums/en/sharepointdevelopment/thread/5d0ae15c-fa2e-41b1-86f4-ce208b88c9b6

share|improve this answer
    
Thanks Colin, that seemed to be the only option open to me, but I'm glad to have it confirmed before I go down that route. –  Gerry Jun 22 '11 at 6:58

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.