diff --git a/www/router.php b/www/router.php index 7baf82a..91b9779 100644 --- a/www/router.php +++ b/www/router.php @@ -99,6 +99,7 @@ function render_twig($template, $args = []) { "site_name" => $SITE_CONFIG['opengraph']['site_name'], "title" => $meta['title'] ?? $SITE_CONFIG['opengraph']['site_name'], "url" => $_SERVER['REQUEST_URI'], + "type" => "article", "description" => $meta['description'] ?? $settings['description'] ?? $SITE_CONFIG['opengraph']['description'] @@ -106,9 +107,10 @@ function render_twig($template, $args = []) { if(($meta['type'] ?? '') == 'image') { $args['og']['image'] ??= $meta['media_file']; + $args['og']['type'] = "image"; } - $args['og']['image'] ??= $SITE_CONFIG['uri_prefix'] . $args['banner'][0]["src"]; + $args['og']['image'] ??= $args['banner'][0]["src"]; $args['banner'] = json_encode($args['banner']); @@ -161,6 +163,25 @@ function try_render_post($SURI) { ]); break; + case 'gallery': + if(preg_match('/^(.*[^\/])((?:#.*)?)$/', $SURI, $match)) { + header('Location: ' . $match[1] . '/' . $match[2]); + + die(); + } + + $search_query = $post['post_metadata']['search_tags'] ?? + ('+type:image +path:' . $post['post_path'] . '/*'); + + $search_result = $adapter->perform_post_search($search_query); + + echo render_twig('post_types/gallery.html', [ + "post" => $post, + "subposts" => $adapter->get_subposts_by_path($SURI), + "gallery_images" => $search_result['results'] + ]); + break; + case 'image': echo render_twig('post_types/image.html', [ "post" => $post, @@ -227,9 +248,6 @@ function generate_website($SURI) { header('Etag: W/"' . $SURI . '/' . strtotime($feed['feed_ts']) . '"'); echo $feed['feed']; - } elseif(!preg_match('/^\s*text\/html/', $_SERVER['HTTP_ACCEPT'])) { - header('Location: /raw' . $SURI); - exit(0); } elseif(true) { try_render_post($SURI); } diff --git a/www/templates/post_types/gallery.html b/www/templates/post_types/gallery.html new file mode 100644 index 0000000..4e96b3d --- /dev/null +++ b/www/templates/post_types/gallery.html @@ -0,0 +1,59 @@ + + +{% extends "pathed_content.html" %} + +{% block extra_head %} + + +{%endblock%} + +{%block content_article%} + {% if subposts|length > 0 %} +
+ | Name | +Title | +Modified | +
---|---|---|---|
+ {{ fa[subpost.post_metadata.icon] | raw }} + | ++ {{subpost.post_basename}} + | ++ {{ subpost.post_metadata.title }} + | ++ {{ subpost.post_update_time }} + | +