added layouts, some base content

This commit is contained in:
2024-10-31 15:09:35 -05:00
parent c5bc48a2af
commit b668156747
17 changed files with 1501 additions and 0 deletions

71
.eleventy.js Normal file
View File

@@ -0,0 +1,71 @@
const handlebarsPlugin = require("@11ty/eleventy-plugin-handlebars");
const handlebars = require('handlebars');
const sass = require("sass");
const pluginRss = require("@11ty/eleventy-plugin-rss");
module.exports = function(eleventyConfig) {
// Passthrough episodes directory to include both markdown and audio files
eleventyConfig.addPassthroughCopy("episodes/*/*.mp3");
eleventyConfig.addPlugin(handlebarsPlugin);
eleventyConfig.addPlugin(pluginRss);
// handlebars helpers
handlebars.registerHelper("formatSeasonEpisode", function(season, episode) {
// Convert strings to integers and pad with zeros
const seasonNumber = parseInt(season, 10).toString().padStart(2, '0');
const episodeNumber = parseInt(episode, 10).toString().padStart(2, '0');
// Return the formatted string
return `<span class="season">S${seasonNumber}</span><span class="episode">E${episodeNumber}</span>`;
// return `S${seasonNumber}E${episodeNumber}`;
});
eleventyConfig.addFilter("seasonEpisodeFormat", function (season, episode, separator="") {
const seasonNumber = parseInt(season, 10).toString().padStart(2, '0');
const episodeNumber = parseInt(episode, 10).toString().padStart(2, '0');
return [seasonNumber, episodeNumber].join(separator)
return value;
});
handlebars.registerHelper('ifEquals', function(arg1, arg2, options) {
return (arg1 == arg2) ? options.fn(this) : options.inverse(this);
});
handlebars.registerHelper('ifIncludes', function(set, candidate, options) {
return (set.includes(candidate)) ? options.fn(this) : options.inverse(this);
});
// Creates the extension for use
eleventyConfig.addTemplateFormats("scss");
eleventyConfig.addExtension("scss", {
outputFileExtension: "css", // optional, default: "html"
// `compile` is called once per .scss file in the input directory
compile: async function (inputContent) {
let result = sass.compileString(inputContent);
// This is the render function, `data` is the full data cascade
return async (data) => {
return result.css;
};
},
});
eleventyConfig.addNunjucksFilter("podcastUrl", function(post) {
// Convert the season and episode to zero-padded numbers
const seasonNumber = parseInt(post.data.season, 10).toString().padStart(2, '0');
const episodeNumber = parseInt(post.data.episode, 10).toString().padStart(2, '0');
// Construct the podcast URL
return `/episodes/s${seasonNumber}/s${seasonNumber}e${episodeNumber}.mp3`;
});
return {
dir: {
data: "data",
input: "content",
output: "dist",
includes: "../layouts"
}
};
};

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
node_modules
**/.obsidian
dist

View File

@@ -0,0 +1,21 @@
---
layout: "base"
override:tags: []
---
<h1>Campaigns</h1>
<ul class="campaigns">
{{#each collections.campaign}}
<li>
<h1>{{data.title}}</h1>
<p>
{{#each data.seasons}}
<a href="/episodes/s0{{this}}">Season {{this}}</a>
{{/each}}
<a href="{{this.url}}">All</a>
</p>
<p>System: {{data.system.name}}</p>
<a href="{{{this.url}}}">Details...</a>
</li>
{{/each}}
</ul>

View File

@@ -0,0 +1,3 @@
{
"tags": "campaign"
}

113
content/css/style.scss Normal file
View File

@@ -0,0 +1,113 @@
$primary-color: #333;
$secondary-color: #f0f0f0;
@import url('https://fonts.googleapis.com/css2?family=Noticia+Text:ital,wght@0,400;0,700;1,400;1,700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=UnifrakturCook:wght@700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap');
body {
font-family: Helvetica, sans-serif, sans-serif;
background-color: $secondary-color;
color: $primary-color;
header {
text-align: center;
background-color: #333;
color: white;
padding: 20px 0;
}
ul.campaigns {
list-style-type: none;
li {
margin: 10px;
padding: 10px;
border: solid grey 1px;
border-radius: 10px;
h1 {
text-align: inherit;
}
}
}
nav {
background-color: #333;
overflow: hidden;
ul {
list-style-type: none;
margin: 0;
padding: 0;
}
/* Style the links inside the navigation bar */
a {
float: left;
color: #f2f2f2;
text-align: center;
padding: 10px 12px;
text-decoration: none;
font-size: 17px;
}
/* Change the color of links on hover */
a:hover {
background-color: #ddd;
color: black;
}
/* Add a color to the active/current link */
a.active {
}
}
h1 {
text-align: center;
}
&.season-5 {
--newspaper-background-texture-image: url(../textures/parchment.jpg);
--newspaper-headline-font: 'Noticia Text';
--newspaper-base-font: 'EB Garamond';
--newspaper-name-font: 'UnifrakturCook';
font-family: var(--newspaper-base-font);
hgroup {
text-align: center;
h1, h2 {
border-bottom: 0px;
font-family: var(--newspaper-headline-font);
line-height: 85%;
}
h1 {
column-count: 1;
font-family: var(--newspaper-name-font);
font-size: 5em;
margin: 8px;
text-align: center;
}
p {
font-style: italic;
}
}
h2 {
text-align: center;
}
article p {
text-align: justify;
}
}
}
header {
background-color: $primary-color;
padding: 10px;
text-align: center;
}
header nav a {
color: $secondary-color;
text-decoration: none;
margin: 0 15px;
}

7
content/data/site.json Normal file
View File

@@ -0,0 +1,7 @@
{
"author": {
"name": "Anthony Correa",
"email": "a@correa.co"
},
"url": "http://localhost:8080"
}

View File

@@ -0,0 +1,5 @@
{
"layout": "episode",
"tags":"episode",
"podcast": true
}

View File

@@ -0,0 +1,14 @@
---
layout: "base"
permalink: "/seasons/"
override:tags: []
---
<ul>
{{#each collections.season}}
<li>
<h1><a href="{{this.url}}">Season {{this.data.season}}</a></h1>
{{{content}}}
</li>
{{/each}}
</ul>

4
content/index.md Normal file
View File

@@ -0,0 +1,4 @@
---
layout: index
---
We are a group of adventurers, storytellers, and dice-rolling enthusiasts who gather weekly to dive into epic campaigns and tell stories together. Whether it's battling ancient dragons, solving mysterious puzzles, or navigating treacherous political intrigues, we bring our characters to life and make unforgettable memories!

22
layouts/base.hbs Normal file
View File

@@ -0,0 +1,22 @@
<!doctype html>
<head>
<meta charset="utf-8">
<title>{{#if title }}{{ title }}{{else}}{{ site.title }}{{/if}} - {{ site.name }}</title>
<link rel="stylesheet" href="/css/style.css">
</head>
<body class="{{{bodyClasses}}}">
<header>
<div>rpg.ascorrea.com</div>
<nav>
<ul>
<li><a href="/">Home</a></li>
<li><a href="/campaigns">Campaigns</a></li>
<li><a href="/seasons">Seasons</a></li>
</ul>
</nav>
</header>
<main>
{{{content}}}
</main>
</body>
</html>

20
layouts/campaign.hbs Normal file
View File

@@ -0,0 +1,20 @@
---
layout: base
---
<h1>{{title}}</h1>
{{{content}}}
<p>{{season}}</p>
<h1>Episodes</h1>
<ul>
{{#each collections.episode}}
{{#ifIncludes ../seasons data.season }}
<li>
<h2>
<a href="{{{this.page.url}}}">
{{{formatSeasonEpisode data.season data.episode }}}: {{{ data.title }}}
</a>
</h2>
</li>
{{/ifIncludes}}
{{/each}}
</ul>

8
layouts/episode.hbs Normal file
View File

@@ -0,0 +1,8 @@
---
layout: base
bodyClasses: "season-{{{season}}}"
eleventyComputed:
bodyClasses: "episode season-{{season}}"
---
{{{content}}}

7
layouts/index.hbs Normal file
View File

@@ -0,0 +1,7 @@
---
layout: base
---
<section>
{{{content}}}
</section>

View File

@@ -0,0 +1,18 @@
---
layout: base
---
<h1>Season {{season}}</h1>
{{{content}}}
<ul>
{{#each collections.episode}}
{{#ifEquals data.season ../season}}
<li>
<h2>
<a href="{{{this.page.url}}}">
{{{formatSeasonEpisode data.season data.episode }}}: {{{ data.title }}}
</a>
</h2>
</li>
{{/ifEquals}}
{{/each}}
</ul>

28
layouts/podcast.hbs Normal file
View File

@@ -0,0 +1,28 @@
---
layout: base
---
{{{content}}}
<h1>By Season</h1>
<ul>
{{#each seasons}}
<li>
<h2>
<a href="{{{site.url}}}/episodes/{{{this}}}">
{{{this}}}
</a>
</h2>
</li>
{{/each}}
</ul>
<h1>By Campaign</h1>
<ul>
{{#each campaigns}}
<li>
<h2>
<a href="/campaigns/{{{this}}}">
{{{this}}}
</a>
</h2>
</li>
{{/each}}
</ul>

1138
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

19
package.json Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "eleventy",
"version": "1.0.0",
"description": "A static site generator",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@11ty/eleventy-navigation": "^0.3.5",
"@11ty/eleventy-plugin-handlebars": "^1.0.0",
"@11ty/eleventy-plugin-rss": "^2.0.2",
"markdown-it": "^14.1.0",
"sass": "^1.80.3"
}
}