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:
Daniel Rudolf 2015-11-02 19:48:58 +01:00
parent 2597e0dd91
commit ebe007bd78

View file

@ -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'])) {