readme and settings
This commit is contained in:
parent
a01dea7cc3
commit
41479e2849
6 changed files with 70 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,6 +3,7 @@ example/output/
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
*__pycache__
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
*$py.class
|
*$py.class
|
||||||
|
|
||||||
|
|
|
||||||
61
README.md
61
README.md
|
|
@ -1,2 +1,63 @@
|
||||||
# micron-blog
|
# micron-blog
|
||||||
|
|
||||||
Pelican Plug-In and Theme for publishing a site in Micron markup format for Nomad Network Nodes
|
Pelican Plug-In and Theme for publishing a site in Micron markup format for Nomad Network Nodes
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Install dependencies
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pip3 install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Create a Static Site from Scratch
|
||||||
|
|
||||||
|
Use the `example` folder as a starting point...
|
||||||
|
|
||||||
|
+ Write your content in markdown formatted files and place them in the `content` folder
|
||||||
|
+ Edit the micron formatted Jinja2 templates in `theme/templates` to your liking
|
||||||
|
+ Generate the blog by running the following command in the `example` folder:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pelican content
|
||||||
|
```
|
||||||
|
|
||||||
|
## Use alongside an existing Pelican installation
|
||||||
|
|
||||||
|
+ Copy the theme and plugin to your Pelican site's folder
|
||||||
|
+ Duplicate your `pelicanconf.py` file to something like `micronconf.py`
|
||||||
|
+ Edit the new file and make sure Pelican can find the new folders by adding them to the `PLUGIN_PATHS` and editing the `THEME` and `PLUGINS` variables respectively
|
||||||
|
+ If you want to place the micron .mu files in a different output folder than your generated HTML files, specify a path in a variable called `MICRON_PATH`
|
||||||
|
+ Make sure `RELATIVE_URLS` is set to `True`
|
||||||
|
+ Make sure all Links in your Markdown articles and pages are relative and local, since you will not be able to access http links inside Nomad Network
|
||||||
|
|
||||||
|
Example Settings, vary depending on your setup:
|
||||||
|
|
||||||
|
```Python
|
||||||
|
PLUGIN_PATHS = ["pelican-plugins"]
|
||||||
|
PLUGINS = ['micron']
|
||||||
|
THEME = 'micron-theme'
|
||||||
|
MICRON_PATH = 'micron_out'
|
||||||
|
RELATIVE_URLS = True
|
||||||
|
```
|
||||||
|
|
||||||
|
Generate the Micron pages by pointing Pelican to the Micron config file:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ pelican content -s micronconf.py
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deployment
|
||||||
|
|
||||||
|
If you have not run Nomad Network yet, initialize the needed folder by running `nomadnet` once
|
||||||
|
|
||||||
|
```
|
||||||
|
$ nomadnet
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy the generated .mu files from the output folder to the NN node's `pages` folder:
|
||||||
|
```
|
||||||
|
$ cp -R output/* ~/.nomadnetwork/storage/pages
|
||||||
|
```
|
||||||
|
|
||||||
|
Run your node and serve the pages....
|
||||||
|
|
@ -24,4 +24,4 @@ RELATIVE_URLS = True
|
||||||
PLUGIN_PATHS = ["../plugin"]
|
PLUGIN_PATHS = ["../plugin"]
|
||||||
PLUGINS = ['micron']
|
PLUGINS = ['micron']
|
||||||
THEME = '../theme'
|
THEME = '../theme'
|
||||||
MICRON_PATH = 'output/micron'
|
MICRON_PATH = 'output/micron'
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import shutil
|
||||||
sys.path.append(os.curdir)
|
sys.path.append(os.curdir)
|
||||||
from pelicanconf import *
|
from pelicanconf import *
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -223,7 +223,8 @@ class MicronWriter(Writer):
|
||||||
|
|
||||||
def __init__(self, output_path, settings):
|
def __init__(self, output_path, settings):
|
||||||
super().__init__(output_path, settings)
|
super().__init__(output_path, settings)
|
||||||
self.output_path = settings.get('MICRON_PATH', 'micron/')
|
out = settings.get('OUTPUT_PATH', 'output/')
|
||||||
|
self.output_path = settings.get('MICRON_PATH', out)
|
||||||
|
|
||||||
def write_file(self, name, template, context, relative_urls=False,
|
def write_file(self, name, template, context, relative_urls=False,
|
||||||
paginated=None, template_name=None, override_output=False,
|
paginated=None, template_name=None, override_output=False,
|
||||||
|
|
|
||||||
4
requirements.txt
Normal file
4
requirements.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
Markdown==3.4.3
|
||||||
|
mistune==3.0.0rc5
|
||||||
|
pelican==4.8.0
|
||||||
|
nomadnet==0.3.5
|
||||||
Loading…
Add table
Add a link
Reference in a new issue