Added posts and pagination
This commit is contained in:
parent
16009fe39e
commit
5bf7bfceee
17 changed files with 182 additions and 18 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,3 +12,4 @@ package-lock.json
|
||||||
/build_production/
|
/build_production/
|
||||||
/source/assets/build/
|
/source/assets/build/
|
||||||
/build_local/
|
/build_local/
|
||||||
|
/source/_posts/
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
# Nikus Blog Template
|
# Nikus Blog Template
|
||||||
|
|
||||||
Here is the template of my blog, released under the MIT license.
|
Here is the template of my blog, released under the MIT license.
|
||||||
|
|
||||||
|
Format Date for Posts like here
|
||||||
|
https://unicode-org.github.io/icu/userguide/format_parse/datetime/#date-field-symbol-table
|
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"tightenco/jigsaw": "^1.3"
|
"tightenco/jigsaw": "^1.3",
|
||||||
|
"ext-intl": "*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
32
config.php
32
config.php
|
@ -1,9 +1,33 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'production' => false,
|
'production' => false,
|
||||||
'baseUrl' => '',
|
'baseUrl' => '',
|
||||||
'title' => 'Jigsaw',
|
'language' => 'de',
|
||||||
'description' => 'Website description.',
|
'title' => 'Nikus Blog',
|
||||||
'collections' => [],
|
'owner' => 'Niku',
|
||||||
|
'email' => 'publicmail [at] [thisDomain] [dot] de',
|
||||||
|
'description' => 'Blogs über IT-Stuff, meine Projekte und allem was sonst so anfällt.',
|
||||||
|
'locale' => 'de_DE',
|
||||||
|
'dateFormat' => 'd. MMMM yyyy',
|
||||||
|
'collections' => [
|
||||||
|
'posts' => [
|
||||||
|
'excerpt' => function ($page, $length = 75) {
|
||||||
|
if (count(explode(' ', strip_tags($page->getContent()))) <= $length){
|
||||||
|
return strip_tags($page->getContent());
|
||||||
|
} else {
|
||||||
|
return implode(' ', array_slice(explode(' ', strip_tags($page->getContent())), 0, $length)) . '...';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
],
|
||||||
|
'dateTranslated' => function ($page, $date) {
|
||||||
|
$format = new IntlDateFormatter(
|
||||||
|
$page->locale,
|
||||||
|
IntlDateFormatter::NONE,
|
||||||
|
IntlDateFormatter::NONE,
|
||||||
|
Null,
|
||||||
|
Null,
|
||||||
|
$page->dateFormat);
|
||||||
|
return datefmt_format($format, $date);
|
||||||
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: 'Custom';
|
font-family: 'Custom';
|
||||||
src: url("JetBrainsMono[wght].ttf");
|
src: url("/assets/fonts/JetBrainsMono[wght].ttf");
|
||||||
}
|
}
|
||||||
|
|
||||||
* {
|
* {
|
||||||
|
@ -84,3 +84,55 @@ main hr {
|
||||||
main hr:last-of-type {
|
main hr:last-of-type {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
section.paginationNavigation {
|
||||||
|
margin-top: 1rem;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer {
|
||||||
|
margin-top: 4rem;
|
||||||
|
border-top: thin solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer div {
|
||||||
|
max-width: 950px;
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 1rem;
|
||||||
|
display: flex;
|
||||||
|
gap: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer div section:first-child {
|
||||||
|
flex: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer div section:last-child {
|
||||||
|
flex: .8;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer div section p {
|
||||||
|
font-size: .8rem;
|
||||||
|
margin: .2rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 500px) {
|
||||||
|
footer div {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
footer div section:last-child {
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 750px) {
|
||||||
|
article section {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
article section h2 {
|
||||||
|
padding-bottom: .5rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -6,17 +6,17 @@
|
||||||
<link rel="canonical" href="{{ $page->getUrl() }}">
|
<link rel="canonical" href="{{ $page->getUrl() }}">
|
||||||
<meta name="description" content="{{ $page->description }}">
|
<meta name="description" content="{{ $page->description }}">
|
||||||
<meta name="color-scheme" content="dark light">
|
<meta name="color-scheme" content="dark light">
|
||||||
<title>{{ $page->title }}</title>
|
<title>{{ $page->owner }}s Blog</title>
|
||||||
<link rel="stylesheet" href="{{ mix('css/main.css', 'assets/build') }}">
|
<link rel="stylesheet" href="{{ mix('css/main.css', 'assets/build') }}">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header>
|
<header>
|
||||||
<h1>Nikus Blog</h1>
|
<h1>{{ $page->owner }}s Blog</h1>
|
||||||
<nav>
|
<nav>
|
||||||
<ul>
|
<ul>
|
||||||
<li aria-current="page"><a href="#">Home</a></li>
|
<li @if($page->getPath() === '/') aria-current="page" @endif><a href="/">Home</a></li>
|
||||||
<li><a href="#">Projects</a></li>
|
<li @if($page->getPath() === '/projects') aria-current="page" @endif><a href="/projects">Projects</a></li>
|
||||||
<li><a href="#">About</a></li>
|
<li @if($page->getPath() === '/about') aria-current="page" @endif><a href="/about">About</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
|
@ -24,7 +24,27 @@
|
||||||
@yield('body')
|
@yield('body')
|
||||||
</main>
|
</main>
|
||||||
<footer>
|
<footer>
|
||||||
<p>Hello World</p>
|
<div>
|
||||||
|
<section>
|
||||||
|
<p>{{ $page->description }}</p>
|
||||||
|
<p>Alle Shitposts hier sind unter der <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a>
|
||||||
|
lizensiert, außer sie sind anders gekennzeichent.</p>
|
||||||
|
<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by-nc-sa/4.0/88x31.png" /></a>
|
||||||
|
<br /><br />
|
||||||
|
<img alt="Always wear your programming socks and thigh highs bedside" src="{{ '/assets/images/programmingsocks.gif' }}">
|
||||||
|
<img alt="An enby flag with the text: Maintained by a queer folk" src="{{ '/assets/images/nocookie.gif' }}">
|
||||||
|
<img alt="This site is certified 100% Cookie free" src="{{ '/assets/images/enby.png' }}">
|
||||||
|
<a href="https://validator.w3.org/nu/?doc=https%3A%2F%2Fblog.nikurasu.de"><img alt="W3C HTML5 badge" src="{{ '/assets/images/html5.png' }}"></a>
|
||||||
|
<img alt="Pride and a LGBTQ flag" src="{{ '/assets/images/pride.gif' }}">
|
||||||
|
<img alt="Not tracked" src="{{ '/assets/images/nottracked.png' }}">
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<p>Linkpage: <a href="https://nikurasu.de">https://nikurasu.de</a></p>
|
||||||
|
<p>E-Mail: <a href="mailTo({{ $page->email }})">{{ $page->email }}</p>
|
||||||
|
<p><a href="/feed.rss">RSS-Feed</a></p>
|
||||||
|
<p><a href="#">Proof of Identity</a></p>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
7
source/_layouts/post.blade.php
Normal file
7
source/_layouts/post.blade.php
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
@extends('_layouts.main')
|
||||||
|
|
||||||
|
@section('body')
|
||||||
|
<h1>{{ $page->title }}</h1>
|
||||||
|
<small>{{ $page->dateTranslated($page->date) }}</small>
|
||||||
|
@yield('content')
|
||||||
|
@endsection
|
6
source/_posts/my-second-post.md
Normal file
6
source/_posts/my-second-post.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
extends: _layouts.post
|
||||||
|
title: My second Blog Post
|
||||||
|
date: 2017-03-27
|
||||||
|
---
|
||||||
|
Non interesting post QwQ
|
6
source/about.blade.php
Normal file
6
source/about.blade.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
@extends('_layouts.main')
|
||||||
|
|
||||||
|
@section('body')
|
||||||
|
<h1>Hello World</h1>
|
||||||
|
<p>{{ $page->getPath() }}</p>
|
||||||
|
@endsection
|
BIN
source/assets/images/enby.png
Normal file
BIN
source/assets/images/enby.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 335 B |
BIN
source/assets/images/html5.png
Normal file
BIN
source/assets/images/html5.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
BIN
source/assets/images/nocookie.gif
Normal file
BIN
source/assets/images/nocookie.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 581 B |
BIN
source/assets/images/nottracked.png
Normal file
BIN
source/assets/images/nottracked.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 373 B |
BIN
source/assets/images/pride.gif
Normal file
BIN
source/assets/images/pride.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 259 B |
BIN
source/assets/images/programmingsocks.gif
Normal file
BIN
source/assets/images/programmingsocks.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
|
@ -1,7 +1,45 @@
|
||||||
|
---
|
||||||
|
pagination:
|
||||||
|
collection: posts
|
||||||
|
perPage: 5
|
||||||
|
---
|
||||||
|
|
||||||
@extends('_layouts.main')
|
@extends('_layouts.main')
|
||||||
|
|
||||||
@section('body')
|
@section('body')
|
||||||
<div>
|
@foreach($pagination->items as $post)
|
||||||
<h1>Hello world!</h1>
|
<article>
|
||||||
</div>
|
<section>
|
||||||
|
<h2><a href="{{ $post->getUrl() }}">{{ $post->title }}</a></h2><small>{{ $page->dateTranslated($post->date) }}</small>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<p>
|
||||||
|
{{ $post->excerpt() }}
|
||||||
|
</p>
|
||||||
|
</section>
|
||||||
|
</article>
|
||||||
|
<hr>
|
||||||
|
@endforeach
|
||||||
|
<section class="paginationNavigation">
|
||||||
|
@if ($previous = $pagination->previous)
|
||||||
|
<a href="{{ $page->baseUrl }}{{ $pagination->first }}"><<</a>
|
||||||
|
<a href="{{ $page->baseUrl }}{{ $previous }}"><</a>
|
||||||
|
@else
|
||||||
|
<< <
|
||||||
|
@endif
|
||||||
|
|
||||||
|
@foreach ($pagination->pages as $pageNumber => $path)
|
||||||
|
@if($pageNumber !== 1) @endif
|
||||||
|
<a href="{{ $page->baseUrl }}{{ $path }}"
|
||||||
|
class="{{ $pagination->currentPage == $pageNumber ? 'selected' : '' }}">{{ $pageNumber }}</a>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
@if ($next = $pagination->next)
|
||||||
|
<a href="{{ $page->baseUrl }}{{ $next }}">></a>
|
||||||
|
<a href="{{ $page->baseUrl }}{{ $pagination->last }}">>></a>
|
||||||
|
@else
|
||||||
|
> >>
|
||||||
|
@endif
|
||||||
|
</section>
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
6
source/projects.blade.php
Normal file
6
source/projects.blade.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
@extends('_layouts.main')
|
||||||
|
|
||||||
|
@section('body')
|
||||||
|
<h1>Hello World</h1>
|
||||||
|
<p>{{ $page->getPath() }}</p>
|
||||||
|
@endsection
|
Loading…
Reference in a new issue