Skip to content

Commit bd97611

Browse files
capjamesgehuss
authored andcommitted
Add rel="edit" for the edit button
rel=edit lets a page indicate that the linked resource can be used to edit the page. It is defined at https://microformats.org/wiki/rel-edit. This can then be parsed by tools like the Universal Edit Button and custom bookmarklets to open the edit page corresponding with a website.
1 parent a918910 commit bd97611

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/front-end/templates/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@
181181
</a>
182182
{{/if}}
183183
{{#if git_repository_edit_url}}
184-
<a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit">
184+
<a href="{{git_repository_edit_url}}" title="Suggest an edit" aria-label="Suggest an edit" rel="edit">
185185
<i id="git-edit-button" class="fa fa-edit"></i>
186186
</a>
187187
{{/if}}

tests/testsuite/rendering.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fn edit_url_template() {
88
BookTest::from_dir("rendering/edit_url_template").check_file_contains(
99
"book/index.html",
1010
"<a href=\"https://github.com/rust-lang/mdBook/edit/master/guide/src/README.md\" \
11-
title=\"Suggest an edit\" aria-label=\"Suggest an edit\">",
11+
title=\"Suggest an edit\" aria-label=\"Suggest an edit\" rel=\"edit\">",
1212
);
1313
}
1414

@@ -18,7 +18,7 @@ fn edit_url_template_explicit_src() {
1818
BookTest::from_dir("rendering/edit_url_template_explicit_src").check_file_contains(
1919
"book/index.html",
2020
"<a href=\"https://github.com/rust-lang/mdBook/edit/master/guide/src2/README.md\" \
21-
title=\"Suggest an edit\" aria-label=\"Suggest an edit\">",
21+
title=\"Suggest an edit\" aria-label=\"Suggest an edit\" rel=\"edit\">",
2222
);
2323
}
2424

0 commit comments

Comments
 (0)