mirror of
https://github.com/docsifyjs/docsify.git
synced 2026-10-17 04:31:18 +08:00
Set html “lang” attribute based on URL hash
Required to trigger auto-translate feature in applicable Chromium-based browsers (Chrome & Edge)
This commit is contained in:
@@ -56,6 +56,14 @@
|
||||
<body>
|
||||
<div id="app">Loading ...</div>
|
||||
<script>
|
||||
// Set html "lang" attribute based on URL
|
||||
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//);
|
||||
|
||||
if (lang) {
|
||||
document.documentElement.setAttribute('lang', lang[1]);
|
||||
}
|
||||
|
||||
// Docsify configuration
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'.*?/awesome':
|
||||
|
||||
@@ -26,6 +26,14 @@
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script>
|
||||
// Set html "lang" attribute based on URL
|
||||
var lang = location.hash.match(/#\/(de-de|es|ru-ru|zh-cn)\//);
|
||||
|
||||
if (lang) {
|
||||
document.documentElement.setAttribute('lang', lang[1]);
|
||||
}
|
||||
|
||||
// Docsify configuration
|
||||
window.$docsify = {
|
||||
alias: {
|
||||
'.*?/awesome': 'https://raw.githubusercontent.com/docsifyjs/awesome-docsify/master/README.md',
|
||||
|
||||
Reference in New Issue
Block a user