Currently, the only way to create a link to a random page is by doing the following:
[[module ListPages category="_default" order="random" limit="1"]]
%%link%%
[[/module]]
This is a really great feature, but the problem is that it only 'caches' a new page every minute or so. This is a problem because when users come and want to see lots of random pages, they keep pressing Random and it keeps showing them just one page. And by analyzing Google Analytics reports, it appears that it causes viewers to leave the site. (It shows they press the button 5 or 6 times, continue to land on the same page, and then finally just leave…)
So my request is that this method be improved to grab a new page each time its pressed, or to create a new module altogether which is able to generate genuinely random page links.
Sorry about the duplicate wish requests, I added the code into the description page and didn't realize that it would spring into action on me. (Which happened once more, and I still didn't realize what had happened, so I ended up creating three duplicates)
And the snippets - solution with the reandom snippets picture - (a point is a single link) in the left side menu is not a good one for the time til we have such a solution?
Service is my success. My webtips:www.blender.org (Open source), Wikidot-Handbook.
Sie können fragen und mitwirken in der deutschsprachigen » User-Gemeinschaft für WikidotNutzer oder
im deutschen » Wikidot Handbuch ?
Well, I'd like to have it show up a single link in the sidebar, to look the same as all of the other links.
(They click Random, which brings them to a page, which redirects to one that is random. This works with the code above, but the problem is that it only re-caches every minute.)
I'll play around with Javascript for now, but it probably work until we have module-nesting or a specific module for random pages.
Yeah, I figured it out!
Just create a link in the Sidebar to the page 'nav:random'.
Then create the page 'nav:random' with this code:
Then create the page 'nav:random-redirect' with this code:
And you're done! Just click on the 'Random' link in your sidebar, and you'll have genuine randomness that doesn't cache like the regular method does. (Which is annoying when you want to see lots of random pages…)
Didn't work for me. Got instead:
The file does not exist.
Go to the site the file comes from. (linked back to home page)
I shouldn't have done that. Now I've got two pages I cannot delete. The nav:random redirects to an error an the nav:random-redirect redirects to an actual page. But they do not work together to produce a random page when the link is clicked. Only the error. I cannot bypass the redirects and so I'm stuck with the pages.
You're getting that error because you didn't replace "<WEBSITE ADDRESS>" with your website's address "http://www.gustrength.com" in the first code block. Change that in the "nav:random" page's code, and it should work.
(To edit a redirection page, navigate to the page as usual, but as soon as the interface loads, press the "X" or "Stop" button on your browser. This will stop it from loading the redirection code and let you make changes. So to make the code fix given above, navigate to "http://www.gustrength.com/nav:random", press "Stop" or "X" as soon as the edit-bar shows up, and then you can edit the page's code without getting redirected. This method can also be used to delete the pages.)
(Note: If the two-page redirection process takes too long on your website, I have another method which cuts it down to one-page, but the setup is more complicated.)
Hi, Venryx!
I replaced the WEBSITE ADDRESS with my address but I still got the same error. I deleted the pages though for now. I should have figured out to just hit X. I've actually done that before in a similar circumstance but when my brain usually shuts down with anything web related. Thanks!
Let me know if you have any ideas as to why the error still occurred. Once I got the website address corrected, everything should have been just as you said. It's definitely something that would be great to have working. If not, no big deal.
I might try doing it again from scratch and perhaps clearing my cache will help. I don't know if that sounds stupid but it can't hurt.
You probably just made a mistake with entering the address. (I added the system from scratch on my own website and it still works)
Here's the changed instructions for your particular website: (I'm assuming you mean 'www.gustrength.com')
1. Create a link in the Sidebar (or wherever you want) to the page 'nav:random'.
2. Then create the page 'nav:random' (which you'll get to by clicking the link you just made) with this code:
3. Then create the page 'nav:random-redirect' (which you'll be redirected to after saving the page you just made) with this code:
If this setup still doesn't work, let me know before you delete it, and I can look at the pages on your website and see what's wrong.
It works now, thanks.
You're right. I didn't enter in the address right at all. I left out part of the page name. Sorry you had to spoon feed this to me, but thanks for doing so. The part about clicking the link to get to the nav:random page made me cringe though..I'm not THAT bad!
The only problem with this is that the browser shuffles through both pages, random, and random-redirect, before it gets to the random page. I changed the names of the pages to let the user know to wait a second while a new page was loading, so it works pretty well now. Thanks so much for the help. At http://gustrength.com, it's in the sidebar under "Get Around GUS"
Yeah, there's actually a way to reduce it down to one page, but it's more complicated and requires the use of i-frames.
If you're interested in this, I'd be happy to give you instructions. :)
P.S. (Haha yeah, I know you knew that already. I'm somewhat of a perfectionist, though, so when I'm improving a set of instructions, I tend to go overboard and change things which are fine already, which leads to excessive instructions and unnecessary preciseness. I've even revised this message itself a number of times just typing it!)
I was just kidding with you. I wasn't offended! I'm fine with the way it is. It only takes a few seconds. I never new how much people liked random pages. It's being used like crazy. Great way to increase people's exposure to the site, and increase page views. You should add this to the code snippets, although maybe wikidot will find grant the original wish.
By the way, I've create a page for it as a code snippet here: http://snippets.wikidot.com/code:genuinely-random-link-generator
I've improved the code a bit since then, and listed guides for both the simple and complex methods. The biggest improvement from the one you're using is that the pages load a bit faster now. (to select a random page, it used to load from 1 to 25 i-frame's, but I've fixed it now so that it loads at most only one.)
Yes, I saw. I will probably be switching to the complex method soon. It is much faster for sure. Thanks again, Venryx. Good stuff.