mirror of
https://github.com/getformwork/formwork.git
synced 2025-03-14 19:19:48 +01:00
Rename site/content to site/pages and move config options
This commit is contained in:
parent
60a9afc2f8
commit
b5a7624c3b
@ -20,11 +20,6 @@ cache:
|
||||
|
||||
charset: utf-8
|
||||
|
||||
content:
|
||||
path: '${%ROOT_PATH%}/site/content'
|
||||
extension: .md
|
||||
safeMode: true
|
||||
|
||||
date:
|
||||
dateFormat: Y-m-d
|
||||
timeFormat: 'h:i A'
|
||||
@ -68,8 +63,12 @@ metadata:
|
||||
setGenerator: true
|
||||
|
||||
pages:
|
||||
path: '${site.path}/pages'
|
||||
index: index
|
||||
error: error
|
||||
content:
|
||||
extension: .md
|
||||
safeMode: true
|
||||
|
||||
panel:
|
||||
enabled: true
|
||||
|
@ -11,7 +11,7 @@ layout:
|
||||
content:
|
||||
collapsible: true
|
||||
label: '{{panel.options.system.content}}'
|
||||
fields: [content.safeMode]
|
||||
fields: [pages.content.safeMode]
|
||||
|
||||
languages:
|
||||
collapsible: true
|
||||
@ -71,7 +71,7 @@ fields:
|
||||
0: '{{panel.options.system.dateAndTime.firstWeekday.sunday}}'
|
||||
1: '{{panel.options.system.dateAndTime.firstWeekday.monday}}'
|
||||
|
||||
content.safeMode:
|
||||
pages.content.safeMode:
|
||||
type: togglegroup
|
||||
label: '{{panel.options.system.content.safeMode}}'
|
||||
description: '{{panel.options.system.content.safeMode.description}}'
|
||||
|
@ -27,7 +27,7 @@ class FileUriGenerator
|
||||
return $this->site->uri($uriPath, includeLanguage: false);
|
||||
}
|
||||
|
||||
if (Str::startsWith($path, $contentPath = FileSystem::normalizePath($this->config->get('system.content.path')))) {
|
||||
if (Str::startsWith($path, $contentPath = FileSystem::normalizePath($this->config->get('system.pages.path')))) {
|
||||
$uriPath = preg_replace('~[/\\\](\d+-)~', '/', Str::after($path, $contentPath))
|
||||
?? throw new RuntimeException(sprintf('Replacement failed with error: %s', preg_last_error_msg()));
|
||||
return $this->site->uri($uriPath, includeLanguage: false);
|
||||
|
@ -523,7 +523,7 @@ class Page extends Model implements Stringable
|
||||
|
||||
$extension = '.' . FileSystem::extension($file);
|
||||
|
||||
if ($extension === $config->get('system.content.extension')) {
|
||||
if ($extension === $config->get('system.pages.content.extension')) {
|
||||
$language = null;
|
||||
|
||||
if (preg_match('/([a-z0-9]+)\.([a-z]+)/', $name, $matches)) {
|
||||
|
@ -566,7 +566,7 @@ class PagesController extends AbstractController
|
||||
|
||||
$filename = $fieldCollection->get('template')->value();
|
||||
$filename .= $language !== null ? '.' . $language : '';
|
||||
$filename .= $this->config->get('system.content.extension');
|
||||
$filename .= $this->config->get('system.pages.content.extension');
|
||||
|
||||
FileSystem::createFile($path . $filename);
|
||||
|
||||
@ -647,7 +647,7 @@ class PagesController extends AbstractController
|
||||
if ($force || $differ) {
|
||||
$filename = $requestData->get('template');
|
||||
$filename .= empty($language) ? '' : '.' . $language;
|
||||
$filename .= $this->config->get('system.content.extension');
|
||||
$filename .= $this->config->get('system.pages.content.extension');
|
||||
|
||||
$fileContent = Str::wrap(Yaml::encode($frontmatter), '---' . PHP_EOL) . $content;
|
||||
|
||||
@ -829,7 +829,7 @@ class PagesController extends AbstractController
|
||||
throw new UnexpectedValueException('Unexpected missing content file');
|
||||
}
|
||||
|
||||
$destination = $page->path() . $template . $this->config->get('system.content.extension');
|
||||
$destination = $page->path() . $template . $this->config->get('system.pages.content.extension');
|
||||
FileSystem::move($page->contentFile()->path(), $destination);
|
||||
$page->reload();
|
||||
return $page;
|
||||
|
@ -19,7 +19,7 @@ class Markdown extends AbstractParser
|
||||
*/
|
||||
public static function parse(string $input, array $options = []): string
|
||||
{
|
||||
$safeMode = App::instance()->config()->get('system.content.safeMode', true);
|
||||
$safeMode = App::instance()->config()->get('system.pages.content.safeMode', true);
|
||||
|
||||
$environment = new Environment([
|
||||
'html_input' => $safeMode ? 'escape' : 'allow',
|
||||
|
@ -22,7 +22,7 @@ class SiteServiceLoader implements ResolutionAwareServiceLoaderInterface
|
||||
$config = Yaml::parseFile(ROOT_PATH . '/site/config/site.yaml');
|
||||
|
||||
return $container->build(Site::class, ['data' => [
|
||||
'path' => $this->config->get('system.content.path'),
|
||||
'path' => $this->config->get('system.pages.path'),
|
||||
'languages' => $this->languages,
|
||||
] + $config]);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 256 KiB After Width: | Height: | Size: 256 KiB |
Before Width: | Height: | Size: 244 KiB After Width: | Height: | Size: 244 KiB |
Loading…
x
Reference in New Issue
Block a user