Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add /random page for loading a random note #361

Open
carbontwelve opened this issue Oct 4, 2024 · 0 comments
Open

Add /random page for loading a random note #361

carbontwelve opened this issue Oct 4, 2024 · 0 comments

Comments

@carbontwelve
Copy link
Contributor

Inspired by https://thecreativeindependent.com/random/ that page uses the following JS within a <head> script element to achieve the random redirect:

var posts = [];
posts.push("..."); // done in template loop outputting all notes urls

document.write("<meta http-equiv=\"refresh\" content=\"1;url=");
document.write(posts[Math.floor(Math.random() * posts.length)]);
document.write("\">");
@carbontwelve carbontwelve added this to the 2024 Release (v3.0) milestone Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant