Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/frostming/flask-blogtheme
Flask extension to read ``_config.yml`` files like Jekyll
https://github.com/frostming/flask-blogtheme
blogging flask flask-extensions yaml
Last synced: about 1 month ago
JSON representation
Flask extension to read ``_config.yml`` files like Jekyll
- Host: GitHub
- URL: https://github.com/frostming/flask-blogtheme
- Owner: frostming
- License: mit
- Created: 2017-08-30T07:48:05.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-09T01:56:46.000Z (over 7 years ago)
- Last Synced: 2024-11-16T03:14:22.064Z (about 2 months ago)
- Topics: blogging, flask, flask-extensions, yaml
- Language: Python
- Size: 9.77 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
Flask-BlogTheme
===============.. image:: https://travis-ci.org/frostming/Flask-BlogTheme.svg?branch=master
:target: https://travis-ci.org/frostming/Flask-BlogTheme*Flask extension to switch blog theme easily*
Features
~~~~~~~~* Clone theme repository to theme folder and set name in config file
* YAML ``_config.yml`` files like Jekyll
* Easily porting theme from Jekyll or HexoInstallation
~~~~~~~~~~~~From PyPI
^^^^^^^^^
::$ pip install Flask-BlogTheme
All are ready for you, prefix the command with ``sudo`` if necessary.
From GitHub
^^^^^^^^^^^
::$ git clone [email protected]:frostming/Flask-BlogTheme.git
$ cd Flask-BlogTheme
$ python setup.py developUsage
~~~~~.. code-block:: python
from Flask-BlogTheme import BlogTheme
from flask import Flaskapp = Flask(__name__)
BlogTheme(app)Create a ``theme`` folder under your app root, clone some theme repository to it. You can pass an extra ``theme_folder`` parameter to ``BlogTheme()`` to change the default folder.
Config the theme just as the guide tells, in ``_config.yml``. The theme repository should obey following restrictions:
* static files under ``assets`` folder
* All layout / templates directly under the theme folder
* Templates are in jinja2-readable formatSet ``app.config['BLOG_THEME_NAME']`` to the theme name. Then, in you ``app.py``:
Then ``{{theme}}`` is accessible throughout your app. You can put some settings in the ``_config.yml`` under app root path to override the theme config.Config
~~~~~~====================== ===========================================================
Config Description
====================== ===========================================================
BLOG_THEME_NAME The theme name
BLOG_THEME_PROCESSOR the context processor for the config, defaults to ``theme``
BLOG_THEME_CONFIG_NAME the config file name, defaults to ``_config.yml``
====================== ===========================================================License
~~~~~~~MIT. See the LICENSE file