1
0
mirror of https://github.com/monstra-cms/monstra.git synced 2025-08-03 11:47:51 +02:00

#431 general structure changes

This commit is contained in:
Awilum
2018-02-28 15:45:05 +03:00
parent 9ca91aa2ce
commit a616757ee0
10 changed files with 22 additions and 46 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@@ -38,7 +38,7 @@ class Blocks
{ {
$blocks_cache_id = ''; $blocks_cache_id = '';
$blocks = File::scan(STORAGE_PATH . '/blocks', 'md'); $blocks = File::scan(CONTENT_PATH . '/blocks', 'md');
if ($blocks) { if ($blocks) {
foreach ($blocks as $block) { foreach ($blocks as $block) {
@@ -70,7 +70,7 @@ class Blocks
*/ */
public static function get($name) public static function get($name)
{ {
if (File::exists($block_path = STORAGE_PATH .'/blocks/' . $name . '.md')) { if (File::exists($block_path = CONTENT_PATH .'/blocks/' . $name . '.md')) {
// Create Unique Cache ID for Block // Create Unique Cache ID for Block
$block_cache_id = md5('block' . ROOT_DIR . $block_path . filemtime($block_path)); $block_cache_id = md5('block' . ROOT_DIR . $block_path . filemtime($block_path));

View File

@@ -88,7 +88,7 @@ class Pages
*/ */
public static function getPages($url = '', $order_by = 'date', $order_type = 'DESC', $ignore = array('404'), $limit = null) public static function getPages($url = '', $order_by = 'date', $order_type = 'DESC', $ignore = array('404'), $limit = null)
{ {
$pages = File::scan(STORAGE_PATH . '/pages/' . $url, 'md'); $pages = File::scan(CONTENT_PATH . '/pages/' . $url, 'md');
if ($pages) { if ($pages) {
foreach ($pages as $page) { foreach ($pages as $page) {
@@ -110,7 +110,7 @@ class Pages
$_pages[$key] = Yaml::parse($_page[1]); $_pages[$key] = Yaml::parse($_page[1]);
$url = str_replace(STORAGE_PATH . '/pages', Url::getBase(), $page); $url = str_replace(CONTENT_PATH . '/pages', Url::getBase(), $page);
$url = str_replace('index.md', '', $url); $url = str_replace('index.md', '', $url);
$url = str_replace('.md', '', $url); $url = str_replace('.md', '', $url);
$url = str_replace('\\', '/', $url); $url = str_replace('\\', '/', $url);
@@ -165,23 +165,23 @@ class Pages
public static function getPage($url) public static function getPage($url)
{ {
// If url is empty that its a homepage // If url is empty then its a homepage
if ($url) { if ($url) {
$file = STORAGE_PATH . '/pages/' . $url; $file = CONTENT_PATH . '/pages/' . $url;
} else { } else {
$file = STORAGE_PATH . '/pages/' . 'index'; $file = CONTENT_PATH . '/pages/' . Config::get('site.pages.main') . '/' . 'index';
} }
// Select the file // Select the file
if (is_dir($file)) { if (is_dir($file)) {
$file = STORAGE_PATH . '/pages/' . $url .'/index.md'; $file = CONTENT_PATH . '/pages/' . $url .'/index.md';
} else { } else {
$file .= '.md'; $file .= '.md';
} }
// Get 404 page if file not exists // Get 404 page if file not exists
if (!file_exists($file)) { if (!file_exists($file)) {
$file = STORAGE_PATH . '/pages/' . '404.md'; $file = CONTENT_PATH . '/pages/404/' . 'index.md';
Response::status(404); Response::status(404);
} }
@@ -197,7 +197,7 @@ class Pages
$page = Yaml::parse($_page[1]); $page = Yaml::parse($_page[1]);
$url = str_replace(STORAGE_PATH . '/pages', Url::getBase(), $file); $url = str_replace(CONTENT_PATH . '/pages', Url::getBase(), $file);
$url = str_replace('index.md', '', $url); $url = str_replace('index.md', '', $url);
$url = str_replace('.md', '', $url); $url = str_replace('.md', '', $url);
$url = str_replace('\\', '/', $url); $url = str_replace('\\', '/', $url);

View File

@@ -12,11 +12,11 @@
// Define the path to the root directory (without trailing slash). // Define the path to the root directory (without trailing slash).
define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd())); define('ROOT_DIR', str_replace(DIRECTORY_SEPARATOR, '/', getcwd()));
// Define the path to the storage directory (without trailing slash). // Define the path to the site directory (without trailing slash).
define('SITE_PATH', ROOT_DIR . '/site'); define('SITE_PATH', ROOT_DIR . '/site-katerinasitnikova');
// Define the path to the storage directory (without trailing slash). // Define the path to the content directory (without trailing slash).
define('STORAGE_PATH', SITE_PATH . '/storage'); define('CONTENT_PATH', SITE_PATH . '/content');
// Define the path to the themes directory (without trailing slash). // Define the path to the themes directory (without trailing slash).
define('THEMES_PATH', SITE_PATH . '/themes'); define('THEMES_PATH', SITE_PATH . '/themes');
@@ -29,6 +29,3 @@ define('CONFIG_PATH', SITE_PATH . '/config');
// Define the path to the cache directory (without trailing slash). // Define the path to the cache directory (without trailing slash).
define('CACHE_PATH', SITE_PATH . '/cache'); define('CACHE_PATH', SITE_PATH . '/cache');
// Define the path to the cache directory (without trailing slash).
define('ACCOUNTS_PATH', SITE_PATH . '/cache');

View File

View File

@@ -5,7 +5,7 @@ description: Monstra is a simple and light-weighted Content Management System
## Stay in touch ## Stay in touch
[Monstra official site](http://monstra.org/) [Monstra official site](http://Monstra.org/)
[Monstra forum](http://forum.Monstra.org/) [Monstra forum](http://forum.Monstra.org/)
[Monstra on Github](https://github.com/Monstra/Monstra) [Monstra on Github](https://github.com/Monstra/Monstra)
[Monstra Gitter chat room](https://gitter.im/Monstra/Monstra) [Monstra Gitter chat room](https://gitter.im/Monstra/Monstra)

View File

@@ -0,0 +1,7 @@
---
title: Главная страница
description: страница
template: home
---
home

View File

@@ -1,28 +0,0 @@
---
title: Welcome
description: Monstra is a simple and light-weighted Content Management System
template: index
---
## Monstra is succesfully installed!
You can start editing the content and customising your site.
### Edit this Page
To edit this page, simply go to the folder you installed Monstra, and then browse to the `/storage/pages/` folder and open the `index.md` file in your editor.
### Create a New page
Creating a new page is very simple in Monstra.
1. Launch your text editor and paste this sample text:
```
---
title: My New Page
---
My new page body.
```
2. Save this file in the `/storage/pages/` folder as `my-new-page.md` and its will be available by this url: http://yoursite/my-new-page
That is it!
{block name=Monstra-docs}