Wikidot Random Element

Using the Wikidot listpages module it's easy to setup an element to randomly display on your site. I'm currently using this solution to display random videos on the sidebar. Here's how it works.

Step 1. Create a new category for your site. In this example I've created a category called random.
Step 2. Create a page used to hold the listpages data and enter the following wiki syntax:

[[module ListPages category="random" perPage="1" order="random" limit="1"]]
%%content%%
[[/module]]

In this example I named the page "video". Be careful not to include anything else on the page.

Step 3. Grab the embed code from few videos from youtube that you want to include in your rotation. Once you find a video you like on youtube, click the "share" button and then the "embed" option. Below the embed code you will see options for controlling the size of the video. Be sure to enter in the appropriate size based on where you intend to display the video on your site. In my example, the video appears in the sidebar with a width of 200px. Copy the embed code provided.

Step 4. With the YT embed code copied, head back to your site and create a new page within the "random" category. For example "random:1" works just as well as "random:Boat_Sinks". Then paste the copied code from YT within html tags. For example:

[[html]]
<iframe width="200" height="131" src="http://www.youtube.com/embed/O6PRM4aEVLE" frameborder="0" allowfullscreen></iframe>
[[/html]]

Repeat step 4 for each video you want to include in your randomized sequence. Be sure to place just one video in each page.

Step 5. Using the wikidot include page feature, place the page you created in step 2 above in the spot you have reserved for your videos. In the example I used the name of the page was "video" and I have it placed in the sidebar so in the nav:side page I'll place the code [[include video]] somewhere near the top.

That's it, you're done. The video will randomize every 60 seconds.

Note

If you're placing videos in the side bar then you might want to clear our the video options that display near the bottom. This will give the video a cleaner look when playing. To do this append the following code to the end of the URL: ?version=3&autohide=1&showinfo=0. For example:

Original Embed Code

Optional Embed Code

To test this out, refresh this page and you will see the video in the sidebar change. You can find additional embed options at code.google.com