diff --git a/README.md b/README.md index 44a21a0..e622a0c 100644 --- a/README.md +++ b/README.md @@ -101,4 +101,25 @@ will be rendered as: If you want the same settings to be honoured by the templates, they need to be implemented respecively. The settings are accessible by the templates: ```jinja {{ MICRON_LINK_FORMAT[0] }}`[{{ p.title }}`:/{{ p.url }}]{{ MICRON_LINK_FORMAT[1] }} -``` \ No newline at end of file +``` + +## Dynamic Content + +If you want to place an executable script file in the output folder, use Pelican's `STATIC_PATHS` +setting to mark it as a static file and the `EXTRA_PATH_METADATA` setting to copy it to +the output folder. + +```python +STATIC_PATHS = ['../scripts/helloworld.mu'] +EXTRA_PATH_METADATA = {'../scripts/helloworld.mu': {'path': 'micron/helloworld.mu'},} +``` + +A good way to link to such a dynamic content file is to add a dummy article or page with an +empty `save_as` meta tag and a `url` tag pointing to the script's final location. +``` +Title: Hello World +Date: 2023-05-22 +save_as: +url: helloworld.mu +``` +(see the `pelicanconf.py `and `script.md` files in the examples folder.) \ No newline at end of file diff --git a/example/content/script.md b/example/content/script.md new file mode 100644 index 0000000..7e9132b --- /dev/null +++ b/example/content/script.md @@ -0,0 +1,20 @@ +Title: Hello World +Date: 2023-05-22 +save_as: +url: helloworld.mu + + \ No newline at end of file diff --git a/example/pelicanconf.py b/example/pelicanconf.py index 38e2101..9550397 100644 --- a/example/pelicanconf.py +++ b/example/pelicanconf.py @@ -25,3 +25,5 @@ PLUGIN_PATHS = ["../plugin"] PLUGINS = ['micron'] THEME = '../theme' MICRON_PATH = 'output/micron' +STATIC_PATHS = ['../scripts/helloworld.mu'] +EXTRA_PATH_METADATA = {'../scripts/helloworld.mu': {'path': 'micron/helloworld.mu'},} \ No newline at end of file diff --git a/example/scripts/helloworld.mu b/example/scripts/helloworld.mu new file mode 100755 index 0000000..b76a3af --- /dev/null +++ b/example/scripts/helloworld.mu @@ -0,0 +1,3 @@ +#!/usr/bin/python3 + +print('Hello World') \ No newline at end of file