aboutsummaryrefslogtreecommitdiffstats
path: root/generate.php
diff options
context:
space:
mode:
authorFran├žois Kooman <fkooman@tuxed.net>2017-01-12 22:32:53 +0100
committerFran├žois Kooman <fkooman@tuxed.net>2017-01-12 22:32:53 +0100
commit03cb4ae7134e10aaea86f9a5b1109e7aea513966 (patch)
treeff71207923682a5da8c14638d9f3936913311d8d /generate.php
parent6c24c8625db5b310a775c9b6c881b2bef99cecb1 (diff)
downloadwww.tuxed.net-03cb4ae7134e10aaea86f9a5b1109e7aea513966.zip
www.tuxed.net-03cb4ae7134e10aaea86f9a5b1109e7aea513966.tar.gz
www.tuxed.net-03cb4ae7134e10aaea86f9a5b1109e7aea513966.tar.xz
new post
Diffstat (limited to 'generate.php')
-rw-r--r--generate.php64
1 files changed, 34 insertions, 30 deletions
diff --git a/generate.php b/generate.php
index ff8cb9a..00c8bdf 100644
--- a/generate.php
+++ b/generate.php
@@ -116,44 +116,48 @@ $indexPage = $twig->render(
);
foreach ($postsList as $post) {
- $postPage = $twig->render(
- 'post.twig',
- [
- 'pagesList' => $pagesList,
- 'activePage' => 'index.html',
- 'blogTitle' => $blogTitle,
- 'pageTitle' => $post['title'],
- 'post' => $post,
- 'blogDescription' => $blogDescription,
- 'blogAuthor' => $blogAuthor,
- ]
- );
- file_put_contents($outputDir.'/'.$post['fileName'], $postPage);
+ if ($post['publish']) {
+ $postPage = $twig->render(
+ 'post.twig',
+ [
+ 'pagesList' => $pagesList,
+ 'activePage' => 'index.html',
+ 'blogTitle' => $blogTitle,
+ 'pageTitle' => $post['title'],
+ 'post' => $post,
+ 'blogDescription' => $blogDescription,
+ 'blogAuthor' => $blogAuthor,
+ ]
+ );
+ file_put_contents($outputDir.'/'.$post['fileName'], $postPage);
+ }
}
foreach ($pagesList as $page) {
- $pagePage = $twig->render(
- 'page.twig',
- [
- 'activePage' => $page['fileName'],
- 'pagesList' => $pagesList,
- 'blogTitle' => $blogTitle,
- 'pageTitle' => $page['title'],
- 'pageContent' => $page,
- 'blogDescription' => $blogDescription,
- 'blogAuthor' => $blogAuthor,
- ]
- );
- file_put_contents($outputDir.'/'.$page['fileName'], $pagePage);
+ if ($post['publish']) {
+ $pagePage = $twig->render(
+ 'page.twig',
+ [
+ 'activePage' => $page['fileName'],
+ 'pagesList' => $pagesList,
+ 'blogTitle' => $blogTitle,
+ 'pageTitle' => $page['title'],
+ 'pageContent' => $page,
+ 'blogDescription' => $blogDescription,
+ 'blogAuthor' => $blogAuthor,
+ ]
+ );
+ file_put_contents($outputDir.'/'.$page['fileName'], $pagePage);
+ }
}
file_put_contents($outputDir.'/index.html', $indexPage);
// copy img
-//@mkdir($outputDir.'/img');
-//foreach (glob(__DIR__.'/img/*') as $imgFile) {
-// copy($imgFile, $outputDir.'/img/'.basename($imgFile));
-//}
+@mkdir($outputDir.'/img');
+foreach (glob(__DIR__.'/img/*') as $imgFile) {
+ copy($imgFile, $outputDir.'/img/'.basename($imgFile));
+}
// copy css
@mkdir($outputDir.'/css');