1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 16:14:16 +02:00

Infrastructure changes: from now, we are using page.md for each page instead of index.md

This commit is contained in:
Awilum
2018-04-22 01:31:38 +03:00
parent 2acd9776c8
commit 43999d0eac
4 changed files with 9 additions and 9 deletions

View File

@@ -75,13 +75,13 @@ class Pages
if ($url) {
$file = $url;
} else {
$file = PAGES_PATH . '/' . Config::get('site.pages.main') . '/' . 'index.md';
$file = PAGES_PATH . '/' . Config::get('site.pages.main') . '/' . 'page.md';
}
} else {
if ($url) {
$file = PAGES_PATH . '/' . $url . '/index.md';
$file = PAGES_PATH . '/' . $url . '/page.md';
} else {
$file = PAGES_PATH . '/' . Config::get('site.pages.main') . '/' . 'index.md';
$file = PAGES_PATH . '/' . Config::get('site.pages.main') . '/' . 'page.md';
}
}
@@ -89,7 +89,7 @@ class Pages
if (Filesystem::fileExists($file)) {
$file = $file;
} else {
$file = PAGES_PATH . '/404/index.md';
$file = PAGES_PATH . '/404/page.md';
Http::setResponseStatus(404);
}
@@ -119,7 +119,7 @@ class Pages
// Get page url
$url = str_replace(PAGES_PATH, Http::getBaseUrl(), $file);
$url = str_replace('index.md', '', $url);
$url = str_replace('page.md', '', $url);
$url = str_replace('.md', '', $url);
$url = str_replace('\\', '/', $url);
$url = str_replace('///', '/', $url);
@@ -209,7 +209,7 @@ class Pages
// Create pages array from pages list and ignore current requested page
foreach ($pages_list as $key => $page) {
if (strpos($page, $url.'/index.md') !== false) {
if (strpos($page, $url.'/page.md') !== false) {
// ignore ...
} else {
$pages[$key] = static::getPage($page, $raw, true);

View File

@@ -105,7 +105,7 @@ class Admin {
$create_page = Http::post('create_page');
if (isset($create_page)) {
if (Filesystem::setFileContent(PAGES_PATH . '/' . Http::post('slug') . '/index.md',
if (Filesystem::setFileContent(PAGES_PATH . '/' . Http::post('slug') . '/page.md',
'---'."\n".
'title: '.Http::post('title')."\n".
'---'."\n")) {
@@ -122,14 +122,14 @@ class Admin {
$save_page = Http::post('save_page');
if (isset($save_page)) {
Filesystem::setFileContent(PAGES_PATH . '/' . Http::post('slug') . '/index.md',
Filesystem::setFileContent(PAGES_PATH . '/' . Http::post('slug') . '/page.md',
'---'."\n".
Http::post('frontmatter').
'---'."\n".
Http::post('editor'));
}
$page = trim(Filesystem::getFileContent(PAGES_PATH . '/' . Http::get('page') . '/index.md'));
$page = trim(Filesystem::getFileContent(PAGES_PATH . '/' . Http::get('page') . '/page.md'));
$page = explode('---', $page, 3);
View::factory('admin/views/pages/editor')