Very initial commit to get going

This commit is contained in:
vib 2023-04-18 17:11:57 +03:00
commit 3b3cd9344b
20 changed files with 4705 additions and 0 deletions

31
.eleventy.js Normal file
View file

@ -0,0 +1,31 @@
module.exports = function (eleventyConfig) {
eleventyConfig.addPassthroughCopy ("src/media");
eleventyConfig.addPassthroughCopy ("src/resources");
eleventyConfig.addPassthroughCopy ("src/robots.txt");
eleventyConfig.addPlugin( require("@11ty/eleventy-plugin-rss") );
const {
DateTime
} = require("luxon");
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
eleventyConfig.addFilter('htmlDateString', (dateObj) => {
return DateTime.fromJSDate(dateObj, {
zone: 'utc'
}).toFormat('yyyy-MM-dd');
});
eleventyConfig.addFilter("readableDate", dateObj => {
return DateTime.fromJSDate(dateObj, {
zone: 'utc'
}).toFormat("yyyy-MM-dd");
});
return {
dir: {
input: "src",
output: "public",
},
};
};

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
node_modules
public

4096
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

17
package.json Normal file
View file

@ -0,0 +1,17 @@
{
"name": "cheri.pink",
"version": "1.0.0",
"description": "Cherie's personal website",
"main": "index.js",
"scripts": {
"start": "eleventy --serve",
"build": "eleventy"
},
"keywords": [],
"author": "cheri",
"license": "MIT",
"devDependencies": {
"@11ty/eleventy": "^2.0.0",
"@11ty/eleventy-plugin-rss": "^1.2.0"
}
}

8
src/_data/site.json Normal file
View file

@ -0,0 +1,8 @@
{
"name": "Cherie's pink site",
"url": "https://cheri.pink",
"authorName": "cheri",
"description": "A personal website with random things, sometimes a blog, Cherie's corner of the internet.",
"language": "en",
"favicon": "https://cheri.pink/media/favicon.svg"
}

48
src/_includes/base.njk Normal file
View file

@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="author" content="{{ site.authorName }}">
<meta name="description" content="{{ site.description }}">
<link rel="icon" href="{{ site.favicon }}" type="image/svg+xml" />
<title>{{ title }}</title>
<link rel="stylesheet" href="/resources/style.css">
</head>
<body>
<nav class="menu">
<div class="nav-left">
<ul>
<li>
<a href="/">
<img class="logo" src="/media/cherry-blossom.png" alt="" />
<span class="sitename">{{ site.name }}</span>
</a>
</li>
</ul>
</div>
<div class="nav-right">
<ul>
<li><a href="/about.html">about</a></li>
<li><a href="https://git.vibb.ro">git</a></li>
<li><a href="https://live.cheri.pink">livestreams</a></li>
<li><a href="/posts/">posts</a></li>
</ul>
</div>
</nav>
<div class="content">
{{ content | safe }}
</div>
<footer>
<p>
Brought here with love &lt3.
Content licensed under <a rel="license" href="http://creativecommons.org/licenses/by-nc/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc/4.0/80x15.png" /></a>
</p>
</footer>
<script src="/resources/themechange.js"></script>
</body>
</html>

View file

@ -0,0 +1,9 @@
<ul>
{% for post in listposts %}
<li>
<strong><a href="{{ post.url | url }}"> {{ post.data.title }}</a></strong>
-
<time datetime="{{ post.date | htmlDateString}}">{{ post.date | readableDate}}</time>
</li>
{% endfor %}
</ul>

8
src/_includes/post.njk Normal file
View file

@ -0,0 +1,8 @@
---
layout: base.njk
---
<h1>{{ title }}</h1>
<h3>{{ date }}</h3>
<article>
{{ content | safe }}
</article>

25
src/feed.njk Normal file
View file

@ -0,0 +1,25 @@
---
permalink: /feed.xml
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:base="{{ site.url }}" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ site.name }}</title>
<link>{{ site.url }}</link>
<atom:link href="{{ permalink | absoluteUrl(site.url) }}" rel="self" type="application/rss+xml" />
<description>{{ site.description }}</description>
<language>{{ site.language }}</language>
{%- for post in collections.posts | reverse %}
{%- set absolutePostUrl = post.url | absoluteUrl(site.url) %}
<item>
<title>{{ post.data.title }}</title>
<link>{{ absolutePostUrl }}</link>
<description>{{ post.templateContent | htmlToAbsoluteUrls(absolutePostUrl) }}</description>
<pubDate>{{ post.date | dateToRfc822 }}</pubDate>
<dc:creator>{{ site.authorName }}</dc:creator>
<guid>{{ absolutePostUrl }}</guid>
</item>
{%- endfor %}
</channel>
</rss>

12
src/index.md Normal file
View file

@ -0,0 +1,12 @@
---
title: Hello thereee
layout: base.njk
---
# My website woah
This is a site wew
**Uhh here is** more stuff <abreviation>DOE</abreviation>
I just want to write some content here

BIN
src/media/cheri-avi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

6
src/posts.njk Normal file
View file

@ -0,0 +1,6 @@
---
layout: base.njk
permalink: /posts/
---
{% set listposts = collections.posts %}
{% include "listposts.njk" %}

21
src/posts/another-post.md Normal file
View file

@ -0,0 +1,21 @@
---
title: wahoo this is another post
description: This post also has a proper description lmao
date: 2023-02-11 09:13:21
---
## Wow!
This is yet another post.
Here is a [link](https://ddg.gg)
Here is an [not pressed link](https://example.org)
<p style="background: var(--bg)">bg</p>
<p style="background: var(--fg)">fg</p>
<p style="background: var(--link)">link</p>
<p style="background: var(--link_v)">link_v</p>
<p style="background: var(--link_h)">link_h</p>
<p style="background: var(--bg_grey)">bg_grey</p>
<p style="background: var(--dark_grey)">dark_grey</p>

4
src/posts/posts.json Normal file
View file

@ -0,0 +1,4 @@
{
"layout": "post.njk",
"tags": "posts"
}

9
src/posts/test-post.md Normal file
View file

@ -0,0 +1,9 @@
---
tags: posts
title: This is a test post!
date: 2022-02-12
---
Here I am going to write **something**.
> Very fancy

363
src/resources/style.css Normal file
View file

@ -0,0 +1,363 @@
html {
font-size: 100%;
overflow-y: scroll;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}
:root {
--bg: #f7caca;
--fg: #2c2c3b;
--link: #FF5975;
--link_v: #F8758B;
--link_h: #771e2d;
--bg_grey: #ebadc1;
--dark_grey: #f46c97;
}
@media (prefers-color-scheme: dark) {
:root {
--bg: #302c3b;
--fg: #fdf0f0;
--link: #ff597d;
--link_v: #f87596;
--link_h: #f94578;
--bg_grey: #2d2531;
--dark_grey: #221c25;
}
}
.logo {
max-height: 30px
}
body {
color: var(--fg);
font-family: 'Open Sans', sans-serif;
font-size: 12px;
line-height: 1.5em;
padding: 1em;
margin: auto;
max-width: 52em;
background: var(--bg);
}
a {
color: var(--link);
text-decoration: none;
}
a:visited {
color: var(--link_v);
}
a:hover {
color: var(--link_h);
cursor:pointer;
background-color: var(--dark_grey);
}
a:active {
color: var(--link_h);
}
a:focus {
outline: thin dotted;
}
a:hover,
a:active {
outline: 0;
}
p {
margin: 1em 0;
}
img {
max-width: 100%;
}
h1,
h2,
h3,
h4,
h5,
h6 {
font-weight: 600;
color: var(--fg);
line-height: 1em;
}
h4,
h5,
h6 {
font-weight: bold;
}
h1 {
font-size: 1.5em;
}
h2 {
font-size: 1.2em;
}
h3 {
font-size: 1em;
}
h4 {
font-size: 0.9em;
}
h5 {
font-size: 0.9em;
}
h6 {
font-size: 0.9em;
}
blockquote {
color: var(--fg);
margin: 0;
padding-left: 3em;
border-left: 0.5em var(--dark_grey) solid;
}
pre,
code,
kbd,
samp {
font-family: 'Fira Code', monospace;
font-size: 0.98em;
}
code {
white-space: pre;
white-space: pre-wrap;
word-wrap: break-word;
background: var(--bg_grey);
color: var(--fg);
padding: 3px;
border-radius: 3px;
}
pre > code {
display: block;
padding: 10px 15px;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
ul,
ol {
margin: 1em 0;
padding: 0 0 0 2em;
}
li p:last-child {
margin: 0;
}
dd {
margin: 0 0 0 2em;
}
img {
border: 0;
-ms-interpolation-mode: bicubic;
vertical-align: middle;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
td {
vertical-align: top;
}
@media only screen and (max-width: 768px) {
body {
font-size: 14px;
}
.sitename {
display: none;
}
}
@media only screen and (min-width: 768px) {
body {
font-size: 16px;
}
article {
margin: 50px 0;
}
}
@media print {
* {
background: transparent !important;
color: black !important;
filter: none !important;
-ms-filter: none !important;
}
body {
font-size: 12pt;
max-width: 100%;
}
a,
a:visited {
text-decoration: underline;
}
hr {
height: 1px;
border: 0;
border-bottom: 1px solid black;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
.ir a:after,
a[href^="javascript:"]:after,
a[href^="#"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid var(--dark_grey);
padding-right: 1em;
page-break-inside: avoid;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
@page :left {
margin: 15mm 20mm 15mm 10mm;
}
@page :right {
margin: 15mm 10mm 15mm 20mm;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
}
nav {
background-color: var(--bg_grey);
padding: 5px;
}
nav ul {
margin: 0;
padding: 0;
list-style-type: none;
overflow: hidden;
}
nav ul li {
/* This allow us to arrange list items in a row, without using float */
display: inline-block;
list-style-type: none;
}
/* Create a style for the first level items */
nav > div > ul > li > a {
color: var(--fg) !important;
display: block;
line-height: 2em;
padding: 0.5em 0.5em;
text-decoration: none;
}
nav > div.nav-right > ul > li > a {
padding: 0.5em 0.5em;
}
nav > div > ul > li > a:hover {
color: var(--fg) !important;
}
.nav-left {
float: left;
}
.nav-left ul li {
float: left;
}
.nav-right ul li {
float: right;
}
.logo {
margin-right: 0.5em
}
article img {
margin: 1em 0;
}
p.date {
font-size: 13px;
color: var(--fg);
}
ul.articles {
list-style: none;
padding: 0;
}
ul.articles li {
padding-bottom: 10px;
}
.content {
padding: 0.5em;
}
footer {
background-color: var(--bg_grey);
padding: 5px;
font-size: 13px;
}

View file

@ -0,0 +1,29 @@
// Get the theme toggle input
const currentTheme = localStorage.getItem("theme"); // If the current local storage item can be found
if (
window.matchMedia &&
window.matchMedia("(prefers-color-scheme: dark)").matches &&
!localStorage.getItem("theme")
) {
localStorage.setItem("theme", "dark");
}
// Function that will switch the theme based on the if the theme toggle is checked or not
function switchTheme() {
if (document.documentElement.getAttribute("data-theme") === "dark") {
document.documentElement.setAttribute("data-theme", "light");
// Set the user's theme preference to dark
localStorage.setItem("theme", "light");
} else {
document.documentElement.setAttribute("data-theme", "dark");
// Set the user's theme preference to light
localStorage.setItem("theme", "dark");
}
}
// Get the current theme from local storage
if (currentTheme) {
// Set the body data-theme attribute to match the local storage item
document.documentElement.setAttribute("data-theme", currentTheme);
}

4
src/robots.txt Normal file
View file

@ -0,0 +1,4 @@
Sitemap: https://cheri.pink/sitemap.xml
User-agent: *
Disallow:

13
src/sitemap.njk Normal file
View file

@ -0,0 +1,13 @@
---
permalink: /sitemap.xml
eleventyExcludeFromCollections: true
---
<?xml version="1.0" encoding="utf-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
{% for page in collections.all %}
<url>
<loc>{{ site.url }}{{ page.url | url }}</loc>
<lastmod>{{ page.date.toISOString() }}</lastmod>
</url>
{% endfor %}
</urlset>