Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/manunamz/jekyll-namespaces
Add file.name.spacing support for jekyll.
https://github.com/manunamz/jekyll-namespaces
digital-garden hierarchy jekyll namespace tree
Last synced: 2 months ago
JSON representation
Add file.name.spacing support for jekyll.
- Host: GitHub
- URL: https://github.com/manunamz/jekyll-namespaces
- Owner: manunamz
- License: gpl-3.0
- Created: 2021-07-22T14:27:28.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-13T22:01:08.000Z (about 3 years ago)
- Last Synced: 2024-04-25T06:02:29.261Z (8 months ago)
- Topics: digital-garden, hierarchy, jekyll, namespace, tree
- Language: Ruby
- Homepage: https://rubygems.org/gems/jekyll-namespaces
- Size: 99.6 KB
- Stars: 6
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Jekyll-Namespaces
⚠️ This is gem is under active development! ⚠️
⚠️ Expect breaking changes and surprises until otherwise noted (likely by v0.1.0 or v1.0.0). ⚠️
Jekyll-Namespaces provides support for long namespacing of markdown filenames with dot `.` delimiters. Frontmatter metadata is added to each document so that they may be referenced by the relationships that make up the overarching hierarchy built from the namespaces. (For example, on a page it may be desirable to link to all `children` of the current page or to build a breadcrumb trail from the current page's ancestry.)
This gem works in conjunction with [`jekyll-graph`](https://github.com/manunamz/jekyll-graph).
This gem is part of the [jekyll-bonsai](https://jekyll-bonsai.netlify.app/) project. 🎋
## Installation
Follow the instructions for installing a [jekyll plugin](https://jekyllrb.com/docs/plugins/installation/) for `jekyll-namespaces`.
## Configuration
Defaults look like this:
```yaml
namespaces:
enabled: true
exclude: []
````enabled`: Toggles the plugin on or off.
`exclude`: A list of any jekyll document type (`pages`, `posts`, and `collections`. [Here](https://ben.balter.com/2015/02/20/jekyll-collections/) is a post on them) to exclude from the namespace tree.
## Usage
Namespaces are delineated by dots, `like.this.md`. There must also be a root document named `root.md`.
Missing levels will not break the build. They will be processed and marked as missing by replacing urls with the namespaced filename.
### Metadata
`ancestors`: Contains a list of url strings for documents along the path from the root document to the current document in the tree.
`children`: Contains a list of url strings of all immediate children of the current document.
`siblings`: Contains a list of url strings of all nodes that share the same direct parent as the current node.
The document for the url can be retrieved in liquid templates like so:
```html
{% for ancestor_url in page.ancestors %}
{% assign ancestor_doc = site.documents | where: "url", ancestor_url | first %}
{{ ancestor_doc.title }}
{% endfor %}
```
```html{% for child_url in page.children %}
{% assign child_doc = site.documents | where: "url", child_url | first %}
{{ child_doc.title }}
{% endfor %}
```