site_opytex/plugins/source-link
2023-04-14 13:56:29 +02:00
..
__init__.py Feat(plugin): add source-link plugin 2023-04-14 13:56:29 +02:00
README.md Feat(plugin): add source-link plugin 2023-04-14 13:56:29 +02:00
source_link.py Feat(plugin): add source-link plugin 2023-04-14 13:56:29 +02:00

Pelican source link plugin

This plugin for Pelican generate two attributes for articles:

  • source_link: link to the source of the article from your forge
  • path_source_link: link to the path of the article from your forge

Installation

Then, add the plugin to your pelicanconf.py file:

PLUGINS = [
    # other plugins...
    "source_link",
]

Usage

To use the plugin, define a constant named GIT_SOURCE in your pelicanconf.py file:

GIT_SOURCE_BASE_URLL = "https://github.com/your-username/your-repo"

This constant should contain the base URL of your Git repository where your source code is stored.

Once the constant is defined, the plugin will generate a source_link and a path_source_link attributes for each article in your Pelican project.

Those links are generated based on the article's source path relative to the root directory of your Pelican project. If the constant PATH is defined in pelicanconf.py, the plugin will use this value as the root directory. Otherwise, it will use the default value of "", which assumes that your Pelican project is located in the same directory as your pelicanconf.py file.