Skip to content

Commit

Permalink
Adding basic random page display
Browse files Browse the repository at this point in the history
  • Loading branch information
Bubobubobubobubo committed Aug 26, 2024
1 parent d43ed85 commit 9efdc2d
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
1 change: 0 additions & 1 deletion .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(eleventySass);
eleventyConfig.addPassthroughCopy("src/media");
eleventyConfig.addPassthroughCopy("src/content");

return {
dir: {
input: "src",
Expand Down
26 changes: 23 additions & 3 deletions src/_includes/navigation.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,34 @@
</div>
<div class="horizontal-scroller">
<div><a class="navlink" href="/gallery">All</a></div>
<div><a class="navlink" href="/">Random</a></div>
<div><a class="navlink" href="/">Mur du son</a></div>
<!-- <div><a class="navlink" href="/random/{{ here i should get a random slug from projects }}">Random</a></div> -->
<div><a class="navlink random-link" href="#">Random</a></div>
<div><a class="navlink" href="/wall-of-sound">Wall of Sound</a></div>
<div><a class="navlink" href="/">Cinema</a></div>
<div><a class="navlink" href="/">Fanzine</a></div>
<div><a class="navlink" href="/"><img src="/media/icon/cookie_24dp_E8EAED_FILL0_wght400_GRAD0_opsz24.svg"></a></div>
</div>
</div>

<script>
var projectSlugs = [
{% for project in projects %}
"{{ project.title | slugify }}"{% unless forloop.last %},{% endunless %}
{% endfor %}
];

function getRandomSlug() {
return projectSlugs[Math.floor(Math.random() * projectSlugs.length)];
}

document.addEventListener("DOMContentLoaded", function() {
var randomSlug = getRandomSlug();
var randomLink = document.querySelector('.random-link');
randomLink.href = "/projects/" + randomSlug;
});

</script>

<style>

.main-bar
Expand Down Expand Up @@ -80,4 +100,4 @@
transition: background-color 0.3s ease, color 0.3s ease;
}

</style>
</style>
6 changes: 6 additions & 0 deletions src/wall_of_sound.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Wall of Sound
permalink: /wall-of-sound/
---
{%include "head.html" %}
{%include "navigation.html" %}

0 comments on commit 9efdc2d

Please sign in to comment.