design article title and add author virtual page
This commit is contained in:
parent
6fe73efbcf
commit
2114fbbb8e
12 changed files with 129 additions and 25 deletions
|
|
@ -1,3 +1,10 @@
|
||||||
main.article {
|
main.article {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.article-header {
|
||||||
|
--margin-left: 2;
|
||||||
|
padding-left: calc(var(--unit--horizontal) * var(--margin-left));
|
||||||
|
margin-bottom: calc(var(--unit--vertical) * 4);
|
||||||
|
width: calc(100% - (var(--margin-left) * var(--unit--horizontal)));
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,20 @@ button,
|
||||||
line-height: calc(var(--unit--vertical));
|
line-height: calc(var(--unit--vertical));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.fs-s {
|
||||||
|
font-size: var(--font-size-s) !important;
|
||||||
|
}
|
||||||
|
.fs-m {
|
||||||
|
font-size: var(--font-size-m) !important;
|
||||||
|
}
|
||||||
|
.fs-l {
|
||||||
|
font-size: var(--font-size-l) !important;
|
||||||
|
}
|
||||||
.fs-xl {
|
.fs-xl {
|
||||||
font-size: var(--font-size-xl);
|
font-size: var(--font-size-xl) !important;
|
||||||
|
}
|
||||||
|
.fs-xxl {
|
||||||
|
font-size: var(--font-size-xxl) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
.title-center {
|
.title-center {
|
||||||
|
|
@ -44,6 +56,13 @@ button,
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.main-title {
|
||||||
|
line-height: 1;
|
||||||
|
text-align: left;
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
p,
|
p,
|
||||||
li,
|
li,
|
||||||
button,
|
button,
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,10 @@
|
||||||
--unit--vertical: 1.7rem;
|
--unit--vertical: 1.7rem;
|
||||||
|
|
||||||
--font-size-s: 0.8rem;
|
--font-size-s: 0.8rem;
|
||||||
--font-size-m: 1.2rem;
|
--font-size-m: calc(var(--font-size-s) * 1.5);
|
||||||
--font-size-l: 1.5rem;
|
--font-size-l: calc(var(--font-size-m) * 1.5);
|
||||||
--font-size-xl: 3.7rem;
|
--font-size-xl: calc(var(--font-size-l) * 1.5);
|
||||||
|
--font-size-xxl: calc(var(--font-size-xl) * 1.5);
|
||||||
|
|
||||||
--font-weight-light: 200;
|
--font-weight-light: 200;
|
||||||
--font-weight-bold: 400;
|
--font-weight-bold: 400;
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ columns:
|
||||||
- width: 1/3
|
- width: 1/3
|
||||||
sections:
|
sections:
|
||||||
texts:
|
texts:
|
||||||
|
label: Textes
|
||||||
type: pages
|
type: pages
|
||||||
templates:
|
templates:
|
||||||
- linear
|
- linear
|
||||||
|
|
|
||||||
|
|
@ -3,12 +3,6 @@ description: Un administrateur a tous les droits.
|
||||||
image:
|
image:
|
||||||
icon: star-filled
|
icon: star-filled
|
||||||
|
|
||||||
columns:
|
fields:
|
||||||
- width: 1/2
|
|
||||||
fields:
|
|
||||||
link:
|
|
||||||
label: Lien
|
|
||||||
- width: 1/2
|
|
||||||
fields:
|
|
||||||
presentation:
|
presentation:
|
||||||
type: writer
|
type: writer
|
||||||
|
|
|
||||||
|
|
@ -19,12 +19,6 @@ permissions:
|
||||||
users:
|
users:
|
||||||
*: false
|
*: false
|
||||||
|
|
||||||
columns:
|
fields:
|
||||||
- width: 1/2
|
|
||||||
fields:
|
|
||||||
link:
|
|
||||||
label: Lien
|
|
||||||
- width: 1/2
|
|
||||||
fields:
|
|
||||||
presentation:
|
presentation:
|
||||||
type: writer
|
type: writer
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Kirby\Uuid\Uuid;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'debug' => true,
|
'debug' => true,
|
||||||
'panel' => [
|
'panel' => [
|
||||||
|
|
@ -44,5 +46,25 @@ return [
|
||||||
'comments',
|
'comments',
|
||||||
'system'
|
'system'
|
||||||
]
|
]
|
||||||
|
],
|
||||||
|
'routes' => [
|
||||||
|
[
|
||||||
|
'pattern' => 'auteur/(:any)',
|
||||||
|
'action' => function ($slug) {
|
||||||
|
$kirby = kirby();
|
||||||
|
$author = getAuthorBySlug($slug);
|
||||||
|
|
||||||
|
return Page::factory([
|
||||||
|
'slug' => '',
|
||||||
|
'template' => 'author',
|
||||||
|
'model' => 'authors',
|
||||||
|
'content' => [
|
||||||
|
'title' => $author->name(),
|
||||||
|
'presentation' => $author->presentation(),
|
||||||
|
'uuid' => Uuid::generate(),
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
|
||||||
37
site/plugins/helpers/index.php
Normal file
37
site/plugins/helpers/index.php
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
function setTitleFontSizeClass($title, $level = 'h1')
|
||||||
|
{
|
||||||
|
$length = strlen($title);
|
||||||
|
|
||||||
|
if ($level === 'h1') {
|
||||||
|
switch (true) {
|
||||||
|
case ($length < 35):
|
||||||
|
return 'fs-xxl';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ($length < 70):
|
||||||
|
return 'fs-xl';
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 'fs-l';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getAuthorBySlug($slug)
|
||||||
|
{
|
||||||
|
$kirby = kirby();
|
||||||
|
$author = '';
|
||||||
|
foreach ($kirby->users() as $user) {
|
||||||
|
|
||||||
|
if (Str::slug($user->name()) === $slug) {
|
||||||
|
|
||||||
|
$author = $user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $author;
|
||||||
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<title><?= $site->title() ?><?= e($page->url() !== $site->url(), '-' . $page->title()) ?></title>
|
<title><?= $site->title() ?><?= e($page->url() !== $site->url(), '-' . $page->title()) ?></title>
|
||||||
<link rel="stylesheet" href="<?= url('assets') ?>/css/style.css" />
|
<link rel="stylesheet" href="<?= url('assets') ?>/css/style.css?version-cache-prevent<?= rand(0, 1000)?>" />
|
||||||
<script src="<?= url('assets') ?>/js/script.js" defer></script>
|
<script src="<?= url('assets') ?>/js/script.js" defer></script>
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script>
|
||||||
<meta name="robots" content="noindex">
|
<meta name="robots" content="noindex">
|
||||||
|
|
|
||||||
24
site/templates/author.php
Normal file
24
site/templates/author.php
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php snippet('header'); ?>
|
||||||
|
<header id="header" class="minimized">
|
||||||
|
<div id="logo" >
|
||||||
|
<a href="/" class="no-line">
|
||||||
|
<h2 id="actuel">actuel</h2>
|
||||||
|
<h2 id="inactuel">inactuel</h2>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<main id="<?= $page->template() ?>">
|
||||||
|
<article>
|
||||||
|
<div class="article-header">
|
||||||
|
<h1 class="main-title title-center <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h1>
|
||||||
|
<p></p>
|
||||||
|
</div>
|
||||||
|
<?php snippet('tabs', [
|
||||||
|
'left' => [
|
||||||
|
'label' => 'Présentation',
|
||||||
|
'content' => $page->presentation()
|
||||||
|
]
|
||||||
|
]) ?>
|
||||||
|
</article>
|
||||||
|
</main>
|
||||||
|
|
@ -8,13 +8,18 @@
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<main id="<?= $page->template() ?>">
|
<main id="<?= $page->template() ?>">
|
||||||
|
<article>
|
||||||
|
<div class="article-header">
|
||||||
|
<h1 class="main-title title-center <?= setTitleFontSizeClass($page->title()) ?>"><?= $page->title() ?></h1>
|
||||||
|
<p>Par <a href="/auteur/<?= Str::slug($page->author()->toUser()->name()) ?>" title="Voir les articles d'<?= $page->author()->toUser()->name() ?>"><?= $page->author()->toUser()->name() ?></a></p>
|
||||||
|
</div>
|
||||||
<?php snippet('tabs', [
|
<?php snippet('tabs', [
|
||||||
'left' => [
|
'left' => [
|
||||||
'label' => 'Édito ' . $page->parent()->title(),
|
'label' => 'Édito ' . $page->parent()->title(),
|
||||||
'content' => $page->parent()->edito()
|
'content' => $page->parent()->edito()
|
||||||
]
|
]
|
||||||
]) ?>
|
]) ?>
|
||||||
<h1 class="title-center"><?= $page->title() ?></h1>
|
</article>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<?php snippet('footer') ?>
|
<?php snippet('footer') ?>
|
||||||
Loading…
Add table
Add a link
Reference in a new issue