forked from brendt/stitcher.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrss.php
More file actions
31 lines (22 loc) · 658 Bytes
/
Copy pathrss.php
File metadata and controls
31 lines (22 loc) · 658 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
use Stitcher\App;
use Stitcher\File;
use Stitcher\Renderer\RendererFactory;
use Stitcher\Variable\VariableParser;
use Stitcher\Variable\YamlVariable;
use Symfony\Component\Yaml\Yaml;
require_once __DIR__ . '/vendor/autoload.php';
File::base(__DIR__ . '/');
App::init();
$posts = YamlVariable::make(
File::path('src/content/blog.yaml'),
App::get(Yaml::class),
App::get(VariableParser::class)
)->getParsed();
$rendererFactory = App::get(RendererFactory::class);
$renderer = $rendererFactory->create();
$rss = $renderer->renderTemplate(
'rss.twig',
['posts' => $posts]
);
file_put_contents(__DIR__ . '/public/rss.xml', $rss);