examples and tutorials

This commit is contained in:
Luca Junge 2023-12-24 12:17:13 +01:00
parent 06914e6c02
commit 96bf869340
22 changed files with 159 additions and 122 deletions

View file

@ -23,7 +23,7 @@ module.exports = function (eleventyConfig) {
eleventyConfig.addFilter("createExcerpt", (post) => { eleventyConfig.addFilter("createExcerpt", (post) => {
// This removes "<" and ">" from the output // This removes "<" and ">" from the output
const content = post.replace(/(<([^>]+)>)/gi, "") const content = post.replace(/(<([^>]+)>)/gi, "")
return content.substr(0, content.lastIndexOf(" ", 180)) + "..." return content.substr(0, content.lastIndexOf(" ", 450)) + "..."
}) })
eleventyConfig.addFilter("stringify", (object) => { eleventyConfig.addFilter("stringify", (object) => {

View file

@ -7,7 +7,7 @@
"start": "npm run dev", "start": "npm run dev",
"dev": "npx @11ty/eleventy --serve", "dev": "npx @11ty/eleventy --serve",
"build": "npx @11ty/eleventy", "build": "npx @11ty/eleventy",
"deploy": "scp -r build/ server:/tmp/ && ssh server 'sudo cp /tmp/build/* ~/www/luca-junge.de/" "deploy": "scp -r build/ server:/tmp/ && ssh server 'sudo cp -r /tmp/build/* ~/www/luca-junge.de/"
}, },
"keywords": [], "keywords": [],
"author": "Luca Junge", "author": "Luca Junge",

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -12,23 +12,13 @@
{% include "partials/header.njk" %} {% include "partials/header.njk" %}
<aside> <aside>
<h1>{{title}}</h1>
<a onclick="history.back()">
<i class="fa fa-solid fa-angle-left"></i>Zurück
</a>
{% if header %}
<div>
<img src="{{ header }}" alt="{{ title }}">
</div>
{% endif %}
<h1>{{ title }}</h1>
</aside> </aside>
<div id="content"> <main>
{{ content | safe }} {{ content | safe }}
</div> </main>
{% include "partials/footer.njk" %} {% include "partials/footer.njk" %}
</body> </body>
</html> </html>

View file

@ -13,8 +13,8 @@
<aside> <aside>
<a onclick="history.back()"> <a class="button" onclick="history.back()">
<i class="fa fa-solid fa-angle-left"></i>Zurück <i class="fa fa-solid fa-angle-left"></i> Zurück
</a> </a>
{% if header %} {% if header %}

View file

@ -1,9 +1,4 @@
@font-face { @font-face {
font-family: "Inter"; font-family: "Quicksand";
src: url("/assets/InterVariable.ttf"); src: url("/assets/fonts/QuicksandVariable.ttf");
}
@font-face {
font-family: "Caveat";
src: url("/assets/CaveatVariable.ttf");
} }

View file

@ -1,5 +1,5 @@
#main-footer { #main-footer {
font-family: "Caveat"; background-color: var(--dark-background-color);
padding: 0.75rem 1rem 0.75rem 1rem; padding: 0.75rem 1rem 0.75rem 1rem;
font-weight: bold; font-weight: bold;
display: flex; display: flex;

View file

@ -1,5 +1,5 @@
#main-header { #main-header {
font-family: "Caveat"; background-color: var(--dark-background-color);
font-size: 20pt; font-size: 20pt;
padding: 18px; padding: 18px;
} }
@ -11,7 +11,7 @@
#main-header ul { #main-header ul {
display: flex; display: flex;
gap: 10px; gap: 20px;
flex-direction: row; flex-direction: row;
justify-content: center; justify-content: center;
align-items: baseline; align-items: baseline;
@ -26,7 +26,9 @@
padding: 0px; padding: 0px;
text-decoration-skip-ink: none; text-decoration-skip-ink: none;
text-underline-offset: 8px; text-underline-offset: 8px;
text-decoration: var(--text-color) wavy underline; text-decoration-thickness: 8px;
text-decoration: underline;
text-decoration-color: var(--accent);
} }
/* Breakpoints */ /* Breakpoints */

View file

@ -1,63 +0,0 @@
article header h1 {
font-weight: bold;
font-size: 1.5rem;
margin: 0px;
}
article header h1 a {
display: block;
text-decoration: none;
}
article header time {
display: block;
padding: 4px 1px;
}
article > p {
margin: 0px;
padding: 0px;
}
article > a {
display: inline-block;
color: var(--accent-red);
text-decoration-thickness: 3px;
margin-bottom: 3px;
padding-top: 8px;
}
ul > li:not(:last-child) {
margin-bottom: 20px;
}
/* Aside Header */
aside a {
background-color: var(--accent-yellow);
color: var(--accent-red);
cursor: pointer;
display: inline-block;
padding: 8px;
font-weight: bold;
border-radius: 8px;
margin-bottom: 8px;
}
aside a i {
margin-right: 4px;
}
aside {
padding: 0px 16px;
}
aside div > img {
display: block;
width: 100%;
border-radius: 8px;
}
aside h1 {
margin: 0em 0px 0.2em 0px;
}

View file

@ -1,3 +1,4 @@
@import url("./fonts.css");
@import url("./normalize.css"); @import url("./normalize.css");
@import url("./variables.css"); @import url("./variables.css");
@import url("./header.css"); @import url("./header.css");
@ -5,17 +6,17 @@
html, html,
body { body {
font-family: "Inter", sans-serif; font-family: "Quicksand", sans-serif;
background-color: antiquewhite; background-color: var(--background-color);
color: var(--text-color); color: var(--text-color);
} }
h1, h1,
h2, h2,
h3 { h3 {
font-family: "Caveat", sans-serif; font-family: "Quicksand", sans-serif;
font-weight: bold; font-weight: bold;
margin-bottom: 4px; margin-bottom: 8px;
} }
h1 > a, h1 > a,
@ -26,6 +27,35 @@ article > a {
color: var(--text-color); color: var(--text-color);
} }
h1::after,
h2::after,
h3::after {
display: block;
width: 100px;
height: 8px;
margin-top: 6px;
margin-bottom: 0px;
content: "";
border-radius: var(--border-radius);
background-color: var(--accent);
}
aside {
padding: 16px;
display: flex;
flex-direction: column;
align-items: center;
}
aside > :not(a) {
flex: 1;
width: 768px;
}
aside a {
align-self: center;
}
main { main {
padding: 16px; padding: 16px;
display: flex; display: flex;
@ -38,8 +68,19 @@ main > * {
width: 768px; width: 768px;
} }
.button {
cursor: pointer;
display: inline-block;
font-weight: bold;
border-radius: var(--border-radius);
padding: 8px;
color: var(--text-color);
background-color: var(--accent);
}
@media (max-width: 400px) { @media (max-width: 400px) {
main > * { main > *,
aside {
width: 100%; width: 100%;
} }
} }

View file

@ -2,9 +2,10 @@
--white: #ffffff; --white: #ffffff;
--black: #000000; --black: #000000;
--background-color: #e0e2db; --background-color: #393e46;
--text-color: #191716; --dark-background-color: #2d3138;
--accent-yellow: #e6af2e; --text-color: #eeeeee;
--accent-blue: #3d348b; --accent: #00adb5;
--accent-red: #b31e57;
--border-radius: 8px;
} }

View file

@ -0,0 +1,7 @@
{
"layout": "post.njk",
"title": "Unnamed",
"tags": "example",
"author": "Luca Junge",
"date": "Created"
}

23
src/examples/examples.njk Normal file
View file

@ -0,0 +1,23 @@
---
title: Alle Beispiele
layout: overview.njk
eleventyExcludeFromCollections: true
---
{%- for post in collections.example -%}
<article>
<header>
<h1>
<a href="{{post.url}}">{{post.data.title}}</a>
</h1>
<time>{{post.date | formatDate }}</time>
</header>
<p>{{post.templateContent | createExcerpt}}</p>
<a class="button" href="{{post.url}}">
Weiterlesen
</a>
</article>
{%- endfor -%}

View file

@ -0,0 +1,7 @@
---
title: Test Example
---
# Hello World
This is a test

View file

@ -16,7 +16,7 @@ permalink: /index.html
<p>{{post.templateContent | createExcerpt}}</p> <p>{{post.templateContent | createExcerpt}}</p>
<a href="{{post.url}}"> <a class="button" href="{{post.url}}">
Weiterlesen Weiterlesen
</a> </a>
</article> </article>

View file

@ -1,26 +1,23 @@
--- ---
title: Alle Posts title: Alle Posts
layout: post-list.njk layout: overview.njk
eleventyExcludeFromCollections: true eleventyExcludeFromCollections: true
--- ---
<ul> {%- for post in collections.post -%}
{%- for post in collections.post -%} <article>
<li> <header>
<article> <h1>
<header> <a href="{{post.url}}">{{post.data.title}}</a>
<h1> </h1>
<a href="{{post.url}}">{{post.data.title}}</a>
</h1>
<time>{{post.date | formatDate }}</time> <time>{{post.date | formatDate }}</time>
</header> </header>
<p>{{post.templateContent | createExcerpt}}</p> <p>{{post.templateContent | createExcerpt}}</p>
<a href="{{post.url}}"> <a class="button" href="{{post.url}}">
Weiterlesen</a> Weiterlesen
</article> </a>
</li> </article>
{%- endfor -%} {%- endfor -%}
</ul>

View file

@ -1,4 +1,4 @@
--- ---
title: This is a test post with a very long title lorem ipsum dolor sit amet title: This is a test post with a very long title lorem ipsum dolor sit amet
draft: false draft: true
--- ---

View file

@ -0,0 +1,7 @@
---
title: Test Tutorial
---
# Hello World
This is a test

View file

@ -0,0 +1,7 @@
{
"layout": "post.njk",
"title": "Unnamed",
"tags": "tutorial",
"author": "Luca Junge",
"date": "Created"
}

View file

@ -0,0 +1,23 @@
---
title: Alle Tutorials
layout: overview.njk
eleventyExcludeFromCollections: true
---
{%- for post in collections.tutorial -%}
<article>
<header>
<h1>
<a href="{{post.url}}">{{post.data.title}}</a>
</h1>
<time>{{post.date | formatDate }}</time>
</header>
<p>{{post.templateContent | createExcerpt}}</p>
<a class="button" href="{{post.url}}">
Weiterlesen
</a>
</article>
{%- endfor -%}