Skip to main content

A Pelican plugin that allows you to cross-reference articles

Project description

Pelican Xref: A Plugin for Pelican

A Pelican plugin that allows you to cross-reference articles in an easy way

Motivation for this plugin

In Pelican, you can reference other articles in the following way:

Title: The second article
Date: 2012-12-01 10:02

See below intra-site link examples in Markdown format.

[a link relative to the current file]({filename}category/article1.rst)
[a link relative to the content root]({filename}/category/article1.rst)

The issue I have with this is that your file structure becomes very rigid. When you move or rename a file or directory all your references are broken.

That is why I created this plugin.

Usage

Step 1: Add xref attribute to your articles

You have to add an attribute named xref to the article attributes, which is only required for articles you want to reference to. The attribute value can contain upper- and lowercase letters, numbers, hyphens (-) and underscores (_).

---
Title: The first article
xref: ref-1
---

...

After you add the xref attribute to an article, you can use it in other articles:

---
Title: The second article
---

This article references the first article with the following syntax: [xref:ref-1]

The syntax has two optional attributes: title and blank. You can use the title attribute if you want to use a custom text instead of the title of the referenced article. The blank attribute is used in case you want the created link to open a new window.

Input Generated html
[xref:ref-1] <a href="/category/the-first-article">The first article</a>
[xref:ref-1 title="Title override"] <a href="/category/the-first-article">Title override</a>
[xref:ref-1 blank=1] <a href="/category/the-first-article" target="_blank">The first article</a>
[xref:ref-1 title="Title override" blank=1] <a href="/category/the-first-article" target="_blank">Title override</a>

Installation

This plugin can be installed via:

pip install pelican-xref

Contributing

Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.

To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelican-xref-0.1.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

pelican_xref-0.1.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file pelican-xref-0.1.1.tar.gz.

File metadata

  • Download URL: pelican-xref-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.7.4 Darwin/19.2.0

File hashes

Hashes for pelican-xref-0.1.1.tar.gz
Algorithm Hash digest
SHA256 64322cfc9b49806bbe6669e983e4aea2b65dfe5f65fc6153e1f9f0613227d456
MD5 6745678e0205bda15e66173e987c231d
BLAKE2b-256 4138ab1a784f2bd04069ec196755f6b73aa06c1ff13ddbefc4cc6735319087f1

See more details on using hashes here.

File details

Details for the file pelican_xref-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pelican_xref-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.7.4 Darwin/19.2.0

File hashes

Hashes for pelican_xref-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8e0a8bc9e676424d3fd56f147e53864db6747862395b5b0693b060fc0f358ace
MD5 42376c399223e60c2c6ca355833b3a96
BLAKE2b-256 dd8facd343e9b935fb7656522a87ed722cd6dda507f661a6dd93eeb7aaa2b674

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page