SOLVED

Set Landing Pages to Expire

Go to solution
Highlighted
Anonymous
Not applicable

Set Landing Pages to Expire

Hi everyone,

Is there a way to have a landing page expire after a certain period of time? For example say for a webinar registration page, after the webinar date the page would direct to a "this event has occurred" kind of message? Or would this be a manual process of going back and editing the page after the event has happened?

Looking forward to everyone's thoughts!

Thanks!

Alec

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Level 10 - Community Moderator

Re: Set Landing Pages to Expire

Search the Community as this has been answered before. Basically, there is no ​true​ expiry but you can add a standard JS snippet to every page that, together with a {{my.token}} storing the expiration date, can redirect people to a "Thanks... for trying" page/popup/etc.

View solution in original post

8 REPLIES 8
Highlighted
Level 10 - Community Moderator

Re: Set Landing Pages to Expire

Search the Community as this has been answered before. Basically, there is no ​true​ expiry but you can add a standard JS snippet to every page that, together with a {{my.token}} storing the expiration date, can redirect people to a "Thanks... for trying" page/popup/etc.

View solution in original post

Highlighted
Level 8

Re: Set Landing Pages to Expire

I'll take Sanford's reply a step further.

In your page template, put in this:

<script type="text/html" id="livepage-html">{{my.Live-Page}}</script>

<script type="text/html" id="expiredpage-html">{{my.Expired-Page}}</script>

Then....

<body>

<div id="body-stuff"></div>

</body>

<script>

if (new Date() > new Date('{{my.expiration-date}}')) {

document.getElementById('body-stuff').innerHTML = document.getElementById('expiredpage-html').innerHTML;

} else {

document.getElementById('body-stuff').innerHTML = document.getElementById('livepage-html').innerHTML;

}

</script>

Then, obviously, in your program put in the following tokens:

expiration-date (type DATE)

Live-Page (type RICH TEXT)

Expired-Page (type RICH TEXT)

Here's an example:

Make an expiration page - JSFiddle

Highlighted
Level 10 - Community Moderator

Re: Set Landing Pages to Expire

... but if both HTML variants are going to be pulled into the DOM no matter what, why contain them in <SCRIPT> tags as you would arbitrary non-HTML data? 

It'll be slower to use innerHTML, which causes a reflow and reparse, than to use a hidden parent element and simply move its children under the visible node.

Highlighted

Re: Set Landing Pages to Expire

Really appreciate you sharing the code Robb. Just to clarify for the tokens:

Live-Page = Landing page URL

Expired-Page = Re-direct to page with message

Is that right?

Highlighted
Level 8

Re: Set Landing Pages to Expire

Highlighted
Level 8

Re: Set Landing Pages to Expire

Sanford posts "Do a search" and gets marked correct.  I post a fiddle and get no love.

The system is rigged.

Level 10 - Community Moderator

Re: Set Landing Pages to Expire

Sorry man. Joe Reitz​ you can switch the Correct to Robb.  (Though in fairness I posted code, too, if you search. )

Highlighted
Level 8

Re: Set Landing Pages to Expire

I was one "Correct" away from Blogging Rights, but it looks like I got it somehow anyway.