feat: simplify README handling

This commit is contained in:
David Bailey 2024-01-22 17:05:11 +01:00
parent dfd8e299cd
commit b420a6eafa
3 changed files with 16 additions and 13 deletions

View file

@ -0,0 +1,11 @@
{
"folders": [
{
"path": "."
},
{
"path": "../dragon_fire_content"
}
],
"settings": {}
}

View file

@ -97,6 +97,10 @@ class PostHandler extends MySQLAdapter {
}
function save_markdown_post($post_path, $post_data) {
if(basename($post_path) == "README.md") {
$post_path = dirname($post_path);
}
$frontmatter_post = YamlFrontMatter::parse($post_data);
$post_path = $this->_sanitize_path($post_path);
@ -110,19 +114,6 @@ class PostHandler extends MySQLAdapter {
$post_metadata['tags'][]= 'type:' . $post_metadata['type'];
if(basename($post_path) == "README.md") {
$readme_metadata = [];
if(isset($post_metadata['settings'])) {
$readme_metadata['settings'] = $post_metadata['settings'];
}
if(isset($post_metadata['directory'])) {
$readme_metadata = $post_metadata['directory'];
}
$this->update_or_create_post(dirname($post_path),
$readme_metadata, $post_content);
}
$this->update_or_create_post($post_path, $post_metadata, $post_content);
}

View file

@ -1,2 +1,3 @@
*.json
*.yml
api_admin_key