feature(post rendering): ability to add additional argument contents
This commit is contained in:
parent
626a4bbaf6
commit
aabe0c72d5
1 changed files with 27 additions and 7 deletions
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
require_once 'fontawesome.php';
|
require_once 'fontawesome.php';
|
||||||
|
|
||||||
$post = $adapter->get_post($REQUEST_PATH);
|
|
||||||
|
|
||||||
function render_root_template($template, $args = []) {
|
function render_root_template($template, $args = []) {
|
||||||
global $twig;
|
global $twig;
|
||||||
|
@ -13,7 +12,7 @@ function render_root_template($template, $args = []) {
|
||||||
$args['page'] ??= $SITE_CONFIG['site_defaults'];
|
$args['page'] ??= $SITE_CONFIG['site_defaults'];
|
||||||
|
|
||||||
$page = $args['page'];
|
$page = $args['page'];
|
||||||
$page['base'] ??= $page['url'];
|
$page['base'] ??= $page['url'] ?? null;
|
||||||
|
|
||||||
$args['opengraph'] = [
|
$args['opengraph'] = [
|
||||||
"site_name" => $page['site_name'] ?? 'Nameless Site',
|
"site_name" => $page['site_name'] ?? 'Nameless Site',
|
||||||
|
@ -34,9 +33,30 @@ function render_pathed_content_template($template, $args = []) {
|
||||||
render_root_template($template, $args);
|
render_root_template($template, $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
render_pathed_content_template('post_types/markdown.html', [
|
function render_post($post, $args = []) {
|
||||||
'page' => $post
|
$template = $post['template']
|
||||||
]);
|
?? ($post['markdown'] == '' ? 'directory' : 'vanilla');
|
||||||
|
|
||||||
|
|
||||||
|
if(isset($post['search'])) {
|
||||||
|
$args['search'] = $adapter->search_posts($post['search']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$args['page'] = $post;
|
||||||
|
|
||||||
|
render_pathed_content_template(
|
||||||
|
'render_templates/' . $template . '.html',
|
||||||
|
$args);
|
||||||
|
}
|
||||||
|
|
||||||
|
if($REQUEST_PATH == '/upload') {
|
||||||
|
render_root_template('upload.html');
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
$post = $adapter->get_post($REQUEST_PATH);
|
||||||
|
render_post($post);
|
||||||
|
|
||||||
die();
|
die();
|
||||||
|
|
||||||
if(!isset($post)) {
|
if(!isset($post)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue