| Server IP : 188.114.96.3 / Your IP : 216.73.216.143 Web Server : Apache System : Linux sv058.home.net.pl 6.8.2 husak_dirty_pages_fix #1 SMP PREEMPT_DYNAMIC Tue Apr 2 22:06:51 CEST 2024 x86_64 User : ( 3194769) PHP Version : 8.5.12 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /polana/ |
Upload File : |
<?php
declare(strict_types=1);
require_once __DIR__ . '/includes/functions.php';
$slug = blog_slugify((string)($_GET['slug'] ?? ''));
$preview = ((string)($_GET['preview'] ?? '') === '1') && public_preview_is_logged_in();
$post = blog_public_post_by_slug($slug,$preview);
if (polana_lang() !== 'pl' && $post && empty($post['content_'.polana_lang()])) $post = null;
if (!$post || (!blog_public_enabled() && !$preview)) {
http_response_code(404);
render_public_head('Nie znaleziono | '.setting('site_name',APP_NAME),'Nie znaleziono wpisu.','/blog',null,'noindex,follow');
render_public_header();
echo '<main class="future-section-page"><section class="page-hero"><div class="container narrow"><h1>Nie znaleziono wpisu.</h1><a href="/blog">Wróć do bloga</a></div></section></main>';
render_public_footer();
exit;
}
$title = polana_lang() !== 'pl' ? (polana_menu_value($post,'title') . ' | ' . setting('site_name',APP_NAME)) : (trim((string)$post['seo_title']) ?: ($post['title'].' | '.setting('site_name',APP_NAME)));
$desc = polana_lang() !== 'pl' ? polana_menu_value($post, 'excerpt') : (trim((string)$post['seo_description']) ?: (string)$post['excerpt']);
$published = $post['publish_at'] ?: $post['created_at'];
$schema = [
'@context'=>'https://schema.org',
'@type'=>'BlogPosting',
'headline'=>polana_menu_value($post,'title'),
'description'=>$desc,
'datePublished'=>date(DATE_ATOM,strtotime($published)),
'dateModified'=>date(DATE_ATOM,strtotime($post['updated_at'])),
'mainEntityOfPage'=>site_url(polana_local_path('/blog/'.$post['slug'])),
'author'=>['@type'=>'Person','name'=>setting('owner_name','Andrzej Polan')],
'publisher'=>['@type'=>'Organization','name'=>setting('site_name',APP_NAME)],
];
if (!empty($post['featured_image'])) $schema['image'] = site_url($post['featured_image']);
render_public_head($title,$desc,'/blog/'.$post['slug'],$schema,$preview?'noindex,follow':'index,follow');
render_public_header('blog');
?>
<main class="blog-article-page">
<article class="container blog-article">
<?php if ($preview): ?><div class="blog-preview-note">Podgląd wpisu nieopublikowanego.</div><?php endif; ?>
<div class="blog-article-head">
<div class="blog-meta">
<?php if (!empty($post['category'])): ?><span><?= e($post['category']) ?></span><?php endif; ?>
<time datetime="<?= e(substr($published,0,10)) ?>"><?= e((new DateTimeImmutable($published))->format('d.m.Y')) ?></time>
</div>
<h1><?= e(polana_menu_value($post,'title')) ?></h1>
<?php if (!empty($post['excerpt'])): ?><p class="blog-lead"><?= e(polana_menu_value($post,'excerpt')) ?></p><?php endif; ?>
</div>
<?php if (!empty($post['featured_image'])): ?>
<figure class="blog-article-image"><img src="<?= e($post['featured_image']) ?>" alt="<?= e(polana_menu_value($post,'title')) ?>"></figure>
<?php endif; ?>
<div class="blog-content"><?= blog_render_content(polana_menu_value($post,'content')) ?></div>
<div class="blog-back"><a href="/blog">← Wszystkie wpisy</a></div>
</article>
</main>
<?php render_public_footer(); ?>