Skip to content

Commit a2f24b5

Browse files
committed
Add structured data to improve looks in search results
1 parent 80f14cd commit a2f24b5

3 files changed

Lines changed: 39 additions & 5 deletions

File tree

_includes/breadcrumbs.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
{% assign parent_dirs=page.url | replace_first: '/', '' | split: '/' %}
22
{% assign link='/' %}
3-
<ol class="breadcrumb">
3+
<ol class="breadcrumb" vocab="http://schema.org" typeof="BreadcrumbList">
4+
{% assign position = 1 %}
45
{% for dir in parent_dirs %}
56
{% if forloop.last %}
6-
<li class="active">{{ dir }}</li>
7-
{% else %}
8-
{% assign link=link | append: dir | append: '/' %}
9-
<li><a href="{{ link }}">{{ dir }}</a></li>
7+
{% assign class = 'active' %}
108
{% endif %}
9+
10+
{% assign link=link | append: dir | append: '/' %}
11+
<li property="itemListElement" typeof="ListItem">
12+
<a href="{{ link }}" property="item" typeof="WebPage">
13+
<span property="name">{{ dir }}</span>
14+
</a>
15+
<meta property="position" content="{{position}}">
16+
</li>
17+
{% assign position = position | plus: 1 %}
1118
{% endfor %}
1219
</ol>

_includes/head.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,8 @@
4242
</div>
4343
</script>
4444

45+
{% if page.extra-head-content %}
46+
{{ page.extra-head-content }}
47+
{% endif %}
48+
4549
</head>

index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ no-footer: 1
44
no-display-title: 1
55
title: ev3dev Home
66

7+
extra-head-content: |
8+
<script type="application/ld+json">
9+
{
10+
"@context": "http://schema.org",
11+
"@type": "Organization",
12+
"url": "http://www.ev3dev.org",
13+
"logo": "http://www.ev3dev.org/images/logo_standard.png"
14+
}
15+
</script>
16+
<script type="application/ld+json">
17+
{
18+
"@context": "http://schema.org",
19+
"@type": "WebSite",
20+
"name": "ev3dev",
21+
"url": "http://www.ev3dev.org/",
22+
"potentialAction": {
23+
"@type": "SearchAction",
24+
"target": "http://www.ev3dev.org/?search={search_term_string}",
25+
"query-input": "required name=search_term_string"
26+
}
27+
}
28+
</script>
29+
730
jumbotron-heading: |
831
ev3dev is your EV3 <strong><i>re-imagined</i></strong>
932
jumbotron-content: |

0 commit comments

Comments
 (0)