Random Link FAQ

Frequently asked questions about the Random Link CGI script.

Q1: How do I add links to the rotation?

Add links by editing the @links array in the script:

@links = (
    "http://example1.com|Example Site 1",
    "http://example2.com|Example Site 2",
    "http://example3.com|Example Site 3"
);

Format: URL|Description

Or use an external file:

$links_file = "/path/to/links.txt";

With links.txt containing one link per line in the same format.

Q2: Can I weight certain links to appear more often?

Yes! To weight links, simply add them multiple times:

@links = (
    "http://priority.com|Priority Site",   # appears 3x
    "http://priority.com|Priority Site",
    "http://priority.com|Priority Site",
    "http://normal.com|Normal Site",       # appears 1x
);

In this example, the priority site has a 75% chance of being selected.

Or use weighted format with a number:

@links = (
    "http://priority.com|Priority Site|3",  # weight 3
    "http://normal.com|Normal Site|1"       # weight 1
);
Note: Weighted format requires script modification to parse the third field.
Back to FAQ