0

I have a publishing page and I need to be able to display - Modified by and Modified date for the page itself - not the dates for the master page.

3

If you are doing this in code behind, try playing with SPContext.Current.Item

I believe the values you needs would be SPContext.Current.Item["Editor"]

and SPContext.Current.Item["Modified"]

  • Would like to avoid code if possible. Thanks for the reply! – user1281545 Nov 26 '13 at 15:55
1

Publishing pages also use a page layout. You can create a new page layout - or copy one of the existing ones and edit it. I generally use SPD for this. A page layout is based on a content type. In this case all content types will have Modified and Modified By so no problem - but in future you can also add custom fields if you want to as long as they are included in the related content type.

When editing the page layout you can insert fields from the content type into the page. From the Insert ribbon tab select SharePoint-> Show Toolbox. This will make a new toolbox appear on the right hand side. At the bottom of this you will find a section titled Content Fields - these can be dragged onto your page layout as needed.

Good luck.

  • Thanks for taking the time to reply!! I found the toolbox and even found a modified by field but couldn't find modified (date/time). – user1281545 Nov 27 '13 at 11:32
  • See if this helps donalconlon.wordpress.com/2013/02/06/… – Dave Paylor Nov 27 '13 at 20:31
  • Thanks tried that and I get an error about its tagprefix not being registered. Yet I have this on the page <%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=******************" %> – user1281545 Nov 28 '13 at 15:37
  • Hmmm - one way I have done this in the past is to create a calculated column on the content type that formats the modified date the way I want it to appear. It will then be available in the toolkit to drag into the page and formatted the way you want. – Dave Paylor Nov 28 '13 at 20:29
  • Hi Sorry to ask daft questions but I'm clearly no where near where you are on SP. I've found the content type associated with the default page layout and I know how to add a column but I don't understand what that would be based on. So how would it be calculated?? Thanks for any help you can give. – user1281545 Nov 29 '13 at 15:20
0

Those columns can be found in the Site Pages library. Add a data view web part for that library, and the default view should include both Modified and Modified By.

To add this information to an individual page, insert an existing list web part and pick Site Pages as your list. Edit the Web Part and change the view: remove all columns aside from Modified and Modified By, and add a filter to show only items where Name = {whatever your page's name is}. Change the Web Part name to something like "Last Edited" or just hide the title, and you should have exactly what you're looking for.

If you want to add something to the master page so that every published page will include Modified and Modified By, add a data view web part of the Site Pages library. In SharePoint Designer, add the Server Parameter HTTP_URL, then filter the data view web part to only show items where the Url is equal to your new parameter. This will error out in SPD but work on the live sites to show only the page that you're on. Pretty it up by hiding unnecessary columns like above and you're set.

  • Thanks for the reply. I want to be able to show on the actual page itself when the page was last updated. – user1281545 Nov 26 '13 at 15:55
  • If you just want to do it on your own page, that's not too hard. Add a web part of the Site Pages library, and add a filter to that view to show only items with Name = {whatever}. You can change the web part title to say "Last Modified" and hide all columns other than Modified and Modified By. Let me know if you need more guidance on doing any of that. If instead you're trying to make every published page show when and who last modified it, you're going to need to build a custom filter in SharePoint Designer, and I can walk you through that, too. – Aron Foster Nov 26 '13 at 16:13
  • Hi thanks for taking the time to reply!! I do want this to be on all pages if possible. But using the method shown above I can't figure out how to access the welcome page/home page in this way?? – user1281545 Nov 27 '13 at 11:31
  • I'm not sure what you mean by "the welcome page/home page". You mean the publishing page template? – Aron Foster Nov 27 '13 at 16:15
  • The first page you see when going on to the site collection. I guess really what I want is for this info to appear as part of the master page if possible?? – user1281545 Nov 28 '13 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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