loikein / blogdown-jump-to-main-button

For more inclusive and accessible Internet.

Home Page:https://notes.loikein.one/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blogdown Jump-to-Main Button

For more inclusive and accessible Internet.

Usage

  1. Add jump-after-toc.js to /static/js
  2. Add jump-after-toc.css to /static/css
  3. Use your preferred way to refer to these two files
  4. Add the following code directly under <body>:
<section class="a11y-links">
<button class="a11y-links__link" tabindex="0" onclick="jumpAfterTOC()">Skip to main content</button>
</section>

How to Refer to the Static Files

This is what I use (all reference files are in this repo):

In baseof.html, after <footer>, add:

{{ range .Site.Params.customJS }}
<script async src="{{ . | relURL }}"></script>
{{ end }}

In the end of head.html, add:

{{ range .Site.Params.customCSS }}
<link rel="stylesheet" href="{{ . | relURL }}">
{{ end }}

In config.yaml, under params, add:

params:
  customCSS: ["/css/jump-after-toc.css"]
  customJS: ["js/jump-after-toc.js"]

  … (other params)

About

For more inclusive and accessible Internet.

https://notes.loikein.one/


Languages

Language:HTML 69.1%Language:CSS 19.9%Language:JavaScript 10.9%