README.md 2.16 KB
Newer Older
Fabien Basmaison's avatar
Fabien Basmaison committed
1 2 3 4 5 6 7 8 9 10 11
# JSON-LD Breadcrumbs Plugin

The **JSON-LD Breadcrumbs** Plugin is an extension for [Grav CMS](http://github.com/getgrav/grav).

It will add a [JSON-LD] [Breadcrumbs definition][schema BreadcrumbList] in the `<head>` of the current page. **Only the routable pages will be listed.**

## Installation

You can installl this plugin by following any of the [options available][install plugins] with the _NAME_ `json-ld-breadcrumbs`:

- The **GPM** (Grav Package Manager) with `bin/gpm install json-ld-breadcrumbs`.
12
- The **manual** method by unzipping the content of the [zip file](https://framagit.org/arkhi/grav-plugin-json-ld-breadcrumbs/-/archive/master/grav-plugin-json-ld-breadcrumbs-master.zip) into `user/plugins/json-ld-breadcrumbs`.
Fabien Basmaison's avatar
Fabien Basmaison committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67

## Configuration

No configuration is needed, the plugin will add the script automatically.

Here is an example, with a subsection that is not routable (_section_1_1_1_).

```json
{
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [
        {
            "@type": "ListItem",
            "position": 0,
            "item": {
                "@type": "WebPage",
                "@id": "http://192.168.19.5",
                "name": "Home"
            }
        },
        {
            "@type": "ListItem",
            "position": 1,
            "item": {
                "@type": "WebPage",
                "@id": "http://192.168.19.5/section_1",
                "name": "Section 1"
            }
        },
        {
            "@type": "ListItem",
            "position": 2,
            "item": {
                "@type": "WebPage",
                "@id": "http://192.168.19.5/section_1/section_1_1",
                "name": "Section 1.1"
            }
        },
        {
            "@type": "ListItem",
            "position": 3,
            "item": {
                "@type": "WebPage",
                "@id": "http://192.168.19.5/section_1/section_1_1/section_1_1_1/page",
                "name": "Page"
            }
        }
    ]
}
```

[JSON-LD]: https://en.wikipedia.org/wiki/JSON-LD
[schema BreadcrumbList]: https://schema.org/BreadcrumbList
[install plugins]: https://learn.getgrav.org/16/plugins/plugin-install