mirror of
https://github.com/LBRYFoundation/lbry.com.git
synced 2025-08-23 17:47:26 +00:00
pr prep
This commit is contained in:
parent
da47484f70
commit
24e34a032b
5 changed files with 45 additions and 4 deletions
|
@ -122,6 +122,7 @@ class Controller
|
|||
$router->get([ContentActions::URL_NEWS . '/{slug:c}?', 'news'], 'ContentActions::executeNews');
|
||||
$router->get([ContentActions::URL_FAQ . '/{slug:c}?', 'faq'], 'ContentActions::executeFaq');
|
||||
$router->get([BountyActions::URL_BOUNTY . '/{slug:c}?', 'bounty'], 'BountyActions::executeList');
|
||||
$router->get([ContentActions::URL_PRESS . '/{slug:c}', 'press'], 'ContentActions::executePress');
|
||||
|
||||
$router->any(['/signup{whatever}?', 'signup'], 'DownloadActions::executeSignup');
|
||||
|
||||
|
|
|
@ -6,12 +6,15 @@ class ContentActions extends Actions
|
|||
SLUG_RSS = 'rss.xml',
|
||||
SLUG_NEWS = 'news',
|
||||
SLUG_FAQ = 'faq',
|
||||
SLUG_PRESS = 'press',
|
||||
|
||||
URL_NEWS = '/' . self::SLUG_NEWS,
|
||||
URL_FAQ = '/' . self::SLUG_FAQ,
|
||||
URL_PRESS = '/' . self::SLUG_PRESS,
|
||||
|
||||
VIEW_FOLDER_NEWS = ROOT_DIR . '/posts/' . self::SLUG_NEWS,
|
||||
VIEW_FOLDER_FAQ = ROOT_DIR . '/posts/' . self::SLUG_FAQ;
|
||||
VIEW_FOLDER_FAQ = ROOT_DIR . '/posts/' . self::SLUG_FAQ,
|
||||
VIEW_FOLDER_PRESS = ROOT_DIR . '/posts/' . self::SLUG_PRESS;
|
||||
|
||||
public static function executeHome(): array
|
||||
{
|
||||
|
@ -113,7 +116,21 @@ class ContentActions extends Actions
|
|||
{
|
||||
return NavActions::execute404();
|
||||
}
|
||||
return ['content/faq-post', ['post' => $post,]];
|
||||
return ['content/faq-post', ['post' => $post]];
|
||||
}
|
||||
|
||||
public static function executePress(string $slug = null): array
|
||||
{
|
||||
Response::enableHttpCache();
|
||||
try
|
||||
{
|
||||
$post = Post::load(static::SLUG_PRESS . '/' . ltrim($slug, '/'));
|
||||
}
|
||||
catch (PostNotFoundException $e)
|
||||
{
|
||||
return NavActions::execute404();
|
||||
}
|
||||
return ['content/press-post', ['post' => $post]];
|
||||
}
|
||||
|
||||
public static function executePressKit(): array
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
class PostNotFoundException extends Exception {}
|
||||
|
||||
class PostMalformedException extends Exception {}
|
||||
|
||||
class Post
|
||||
{
|
||||
const SORT_DATE_DESC = 'sort_date_desc';
|
||||
|
@ -38,7 +40,11 @@ class Post
|
|||
throw new PostNotFoundException('No post found for path: ' . $relativeOrAbsolutePath);
|
||||
}
|
||||
|
||||
list($ignored, $frontMatter, $content) = explode('---', file_get_contents($path), 3);
|
||||
list($ignored, $frontMatter, $content) = explode('---', file_get_contents($path), 3) + ['','',''];
|
||||
if (!$frontMatter || !$content)
|
||||
{
|
||||
throw new PostMalformedException('Post "' . basename($path) . '" is missing front matter or content');
|
||||
}
|
||||
return new static($postType, $slug, Spyc::YAMLLoadString(trim($frontMatter)), trim($content));
|
||||
}
|
||||
|
||||
|
|
5
posts/press/testing.md
Normal file
5
posts/press/testing.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Press Release
|
||||
---
|
||||
|
||||
stuff goes here
|
12
view/template/content/press-post.php
Normal file
12
view/template/content/press-post.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php Response::setMetaDescription($post->getTitle()) ?>
|
||||
<?php Response::addMetaImages($post->getImageUrls()) ?>
|
||||
<?php echo View::render('nav/_header') ?>
|
||||
<main>
|
||||
<section class="post-content">
|
||||
<div class="content">
|
||||
<h1><?php echo htmlentities($post->getTitle()) ?></h1>
|
||||
<?php echo $post->getContentHtml() ?>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<?php echo View::render('nav/_footer') ?>
|
Loading…
Add table
Reference in a new issue