Developer forum

Forum » CMS - Standard features » Temporary redirect

Temporary redirect

Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi there,

I have the following site structure:

Press Releases
  2014
    August
    July
Footer
  Press Releases

From the page /Footer/Press Releases I would like to link to the most recent press release under Press Releases. I explained the content manager how to set the Shortcut property of the Footer/Press Releases manually to the latest page they just added.

This works fine, until a new page is created. Even when they update the link in the footer, it keeps redirecting to the previously selected page because the short cut issues a 301 which gets cached.

This leads to two questions:

1. How can I prevent the permanent redirect?

2. Is there an even better way to do this in order to prevent the manual setup each time a new article is added?

Thanks in advance,

Imar


Replies

 
Morten Bengtson
Reply

Does it have to be a redirect?

If these press releases are item based, maybe you could use Item Publisher to generate the link (page size = 1, orderby = created date, descending), optionally by using the Item.RenderList extension.

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Hi Morten,

It doesn't have to be a redirect, as long as they end up on the right page ;-)

And yes, item types would work well. We do exactly that for other types of content based on items. Unfortunately, these pages are still old pages and paragraphs....

Thanks!

Imar

 
Morten Bengtson
Reply
This post has been marked as an answer

The only options I can think of... 

A) Add a website setting that links to a press release.

B) Create an XSLT navigation template that looks up the most recent press release based on the year/month structure and page sort order (assuming that the latest press release is either the first or last page under a month page).

C) Hack it in a Razor template :)

Votes for this answer: 1
 
Mikkel Ricky
Reply

Apart from using a website setting for this I agree with everything that Morten says!

It's pretty easy to (manually) convert old pages to item based pages using some tricks in the database, and in Dynamicweb 8.5 there's a button for doing it (cf. http://developer.dynamicweb.com/releases/dynamicweb-8-5.aspx#14237).

Best regards,
Mikkel

 
Nicolai Høeg Pedersen
Reply

Hi Imar

@1: You cannot change the current behavior. I've just added to our code though, that 301s from the pageview gets an expire date in the past and sets the cache-control header to "no-store, no-cache, must-revalidate" which should instruct the browser to not cache the redirect. Coming to a Dynamicweb near you soon (8.5.1 + 8.4.1)

@2: You already got some suggestions. My only other idea is to make the link in the bottom not use shortcut, but have a paragraph that then redirects to the current presse release using JS. Ugly, you briefly see the page, but it works.

Nicolai

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

>> and in Dynamicweb 8.5 there's a button for doing it

Ha, yes, but it also says: "ll content in the item type that you change from will be lost." Does that mean that paragraph content is lost as well? Or is that stored in the paragraph list?

Thanks for everyone's answers. Enough to think about and solve this.For now, I like the Area setting along with the non-cached redirect best.

Cheers,

Imar

 
Mikkel Ricky
Reply

"ll content in the item type that you change from will be lost." (sic!) only means that changing from one item type to another will remove all data in item fields on the old item. General page properties (show/hide in menu, activation dates, etc.) will not be changed and any paragraphs on the page will also survive the operation.

Best regards,
Mikkel

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

Sounds good; thanks.

 

Imar

 

You must be logged in to post in the forum