Skip to content

Commit

Permalink
Dynamic window title and lang tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Kale-Ko committed Feb 1, 2022
1 parent 66929be commit f443173
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="en-US">
<html lang="en">

<head>
<title>Emotecraft Wiki</title>
Expand Down Expand Up @@ -40,7 +40,13 @@
}
})
} else {
return fetch("./pages/en/404-untranslated-page.md").then(res => res.text())
return fetch("./pages/" + lang + "404-untranslated-language.md").then(res => {
if (res.status != 404) {
return res.text()
} else {
return fetch("./pages/en/404-untranslated-language.md").then(res => res.text())
}
})
}
})
} else {
Expand Down Expand Up @@ -70,6 +76,9 @@
main.innerHTML = marked.parse(markdown)
fixLinks(main)

document.title = main.children.item(0).innerHTML + " - " + main.children.item(1).innerHTML
document.querySelector("html").lang = lang

fetch("./pages/" + lang + "/sidebar.md").then(res => {
if (res.status != 404) {
return res.text()
Expand Down

0 comments on commit f443173

Please sign in to comment.