Note: as of the 19th November 2012, Wikidot has implemented a full solution which no longer requires this snippet. View their solution here.
While Wikidot is a wiki platform, some users might wish to show users a more useful message when a page doesn't exist. With this snippet, you can redirect users to a custom 404 page and still get access to create the page using the standard /edit/true URL tags.
Following the tradition of James' JS-based snippets, I too will show the "framework".
|url||yes||valid URL or website address||none||Specifies the URL to redirect the user to when a page doesn't exist|
You will need to copy the code into the side bar (usually nav:side):
[[include :snippets:404-redirect |url=http://www.wikidot.com ]]
Link to edit
You can also include a link to create the page that wasn't found. Simply add the following line to your 404 page:
[[include :snippets:404-link |label=Click here to create the page |width=200px |height=30px ]] [!-- Note, all fields are optional --]
It's currently in action on the Community site as well as in my personal sandbox:
thispageblahblah — this page doesn't exist, it'll be redirected to the 404 page
404 — the 404 landing page
Community Home Page — the page exists, so we're not redirected to the 404 page :)
- 27th Aug 2012: decreased iframe size by 124 bytes. Hopefully this will make redirection that little bit faster.
- 28th Aug 2012: added "create page" functionality in 404 page. Simply include [[include :snippets:404-link…
Thanks to tsangk for this great snippet: conditional-blocks
text above inserted with:
[[include :snippets:if START |unique=1|type=equal|var1=%%name%%|var2=conditional-blocks]]
**##red|Thanks to tsangk for this great snippet:##** [[[code:conditional-blocks]]]
[[include :snippets:if END]]
Other snippets posted by tsangk
Rate this solution
If you think this solution is useful — rate it up!