Guess content directory
As pointed out by @Lomanic (see https://github.com/picocms/Pico/pull/260#issuecomment-153091890; thank you btw\!) we actually have to explain users how to change the content directory. This runs contrary to our "stupidly simple" claim. So Pico now simply uses the `content` directory when it exists...
This commit is contained in:
parent
2597e0dd91
commit
ebe007bd78
1 changed files with 9 additions and 2 deletions
11
lib/Pico.php
11
lib/Pico.php
|
@ -437,7 +437,7 @@ class Pico
|
|||
'twig_config' => array('cache' => false, 'autoescape' => false, 'debug' => false),
|
||||
'pages_order_by' => 'alpha',
|
||||
'pages_order' => 'asc',
|
||||
'content_dir' => $this->getRootDir() . 'content-sample/',
|
||||
'content_dir' => null,
|
||||
'content_ext' => '.md',
|
||||
'timezone' => ''
|
||||
);
|
||||
|
@ -453,7 +453,14 @@ class Pico
|
|||
if (empty($this->config['base_url'])) {
|
||||
$this->config['base_url'] = $this->getBaseUrl();
|
||||
}
|
||||
if (!empty($this->config['content_dir'])) {
|
||||
if (empty($this->config['content_dir'])) {
|
||||
// try to guess the content directory
|
||||
if (is_dir($this->getRootDir() . 'content')) {
|
||||
$this->config['content_dir'] = $this->getRootDir() . 'content/';
|
||||
} else {
|
||||
$this->config['content_dir'] = $this->getRootDir() . 'content-sample/';
|
||||
}
|
||||
} else {
|
||||
$this->config['content_dir'] = $this->getAbsolutePath($this->config['content_dir']);
|
||||
}
|
||||
if (!empty($this->config['timezone'])) {
|
||||
|
|
Loading…
Reference in a new issue