1
0
mirror of https://github.com/squidfunk/mkdocs-material.git synced 2024-11-12 01:50:52 +01:00

Added skip link component

This commit is contained in:
squidfunk 2020-03-04 21:44:22 +01:00
parent dbb5b2e8c3
commit 66376bbe8c
2 changed files with 4 additions and 1 deletions

View File

@ -49,6 +49,7 @@ export type Component =
| "search-query" /* Search input */
| "search-reset" /* Search reset */
| "search-result" /* Search results */
| "skip" /* Skip link */
| "tabs" /* Tabs */
| "toc" /* Table of contents */
@ -115,6 +116,7 @@ export function setupComponents(
/* Top-level components: update */
case "header-title":
case "container":
case "skip":
if (name in prev && typeof prev[name] !== "undefined") {
prev[name]!.replaceWith(next[name]!)
prev[name] = next[name]

View File

@ -205,7 +205,8 @@
<!-- Link to skip to content -->
{% if page.toc | first is defined %}
<a href="{{ (page.toc | first).url }}" class="md-skip">
{% set skip = page.toc | first %}
<a href="{{ skip.url | url }}" class="md-skip" data-md-component="skip">
{{ lang.t('skip.link.title') }}
</a>
{% endif %}