Commit 7adda64b authored by Axel Dürkop's avatar Axel Dürkop
Browse files

Add Howto

parent b910d2dd
Pipeline #13683 passed with stage
in 24 seconds
# LRMI Metadata for GitBooks
## Basic idea
This example shows how LRMI metadata can be added to GitBooks.
As GitBook allows a YAML frontmatter the metadata can be put there. It was decided to put everything under the namespace `lrmi` resulting e.g. in
```yaml
---
lrmi:
"@context": http://schema.org
id: https://homepage-of-the-course.de/hund.html
name: Kapitel 1 Der Hund
type: CreativeWork
isPartOf: https://homepage-of-the-course.de
about:
- dogs
---
```
The information under `lrmi` will be injected into two different template extensions:
### `layout.html`
This file extends the layout of the site by adding a `script` tag to the `<head>` and inject the data from `page.lrmi` in JSON format into it.
```html
{% extends template.self %}
{% block head %}
{{ super() }}
<script type="application/ld+json">
{{ page.lrmi | dump() }}
</script>
{% endblock head %}
```
### `page.html`
The same is done with the data under `lrmi` in the YAML frontmatter of pages.
## How to prepare your GitBook
In order to implement this approach for your GitBook put the folder `_layouts` with the two files included into your file tree.
Add LRMI metadata to the YAML frontmatter in `README.md` in order to describe the GitBook in general.
Add LRMI metadata to the YAML frontmatter in every page.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment