checlou / flat-file-cms-bundle
Bundle to add a CMS based on markdown files to an symfony web app
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=7.2.5
- ext-mbstring: *
- erusev/parsedown: ^1.7
- erusev/parsedown-extra: ^0.8.1
- judev/php-htmltruncator: ^1.2
- symfony/asset: ^5.4|^6.0
- symfony/config: ^5.4|^6.0
- symfony/finder: ^5.4|^6.0
- symfony/framework-bundle: ^5.4|^6.0
- symfony/routing: ^5.4|^6.0
- symfony/twig-bridge: ^5.4|^6.0
- symfony/twig-bundle: ^5.4|^6.0
- symfony/yaml: ^5.4|^6.0
- twig/intl-extra: ^3.7
- twig/twig: ^2.12|^3.0
Requires (Dev)
- phpunit/phpunit: ^8
- symfony/browser-kit: ^5.4|^6.0
- symfony/css-selector: ^5.4|^6.0
- symfony/http-kernel: ^5.4|^6.0
- symfony/web-profiler-bundle: ^5.4|^6.0
This package is auto-updated.
Last update: 2024-11-17 19:44:31 UTC
README
Symfony Bundle to create a CMS with flat files into a symfony app.
Purpose
Provide a solution to a CMS feature in an existing symfony app.
- Content in markdown files
Fast installation
Requirements : install a basic symfony app with composer.
symfony new my_project_directory --version="6.3.*"
composer require checlou/flat-file-cms-bundle
Set the configuration in config/packages/checlou_flat_file_cms.yaml
:
checlou_flat_file_cms: content_path: '%kernel.project_dir%/var/cms'
Copy files from Tests/Functional/app/Website/cms
to var/cms
to a basic page dataset.
Theming
The default theming is a basic bootstrap 4 theme. You can override it by overriding the twig templates.
- Write documentation to explain how to override twig templates
Content example
File
Name of the file : a-page.md
--- title: Page title type: page slug: a-page.html --- Summary === Main content
Two differents types of content :
- page : a page with a title, a summary and a main content
- post : a post with a title, a summary and a main content
Default values :
- type : page
- slug : filename with
.html
extension and path as prefix - title : filename without extension
Organized by folders
content/
├── a-page.md
├── index.md
├── blog/
│ ├── a-post.md
│ └── another-post.md
│ └── a-category/
│ └── a-post.md
The index.md file is the content used to display the home page of the CMS. You can use this kind of file to create a page with a slug like
/home
with anindex.md
file in the folderhome/
Others solutions to manage flat files
Pico CMS or Grav CMS
Full app to manage a website with flat files. But you can not use it to add a CMS feature to an existing app. Use Symfony components.
Symfony Bundles
- https://github.com/maschmann/MarkdownContentBundle : too old (last commit in 2015)
Twig markdown to html
Extension to convert markdown to html in twig templates. We do not use it. Should we use it ?
https://twig.symfony.com/doc/3.x/filters/markdown_to_html.html
Ideas
Todo
- More tests of Page and Pages class and Twig extension
- Shortcode system
- Inject global vars to use in markdown : by configuration and by event
- Content cache to rebuild without parsing files
- Configure the CMS to say that pages are isolated (no parent) even if it's in a subfolder
- Usecase : a specific folder with isolated pages
- Transform link to markdown file to the url of the page
- Usecase : use autocompletion in markdown editor to link to another page
- Command to generate all the website as an artefact
- Usecase : use Github Pages to host the website
- Use https://twig.symfony.com/doc/3.x/filters/markdown_to_html.html ?