Files
simplex-chat/website/src/_includes/layouts/article.html
T

126 lines
4.5 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>{{ title }}</title>
<link rel="icon" type="image/png" sizes="96x96" href="/img/favicon.ico" />
<link href="/css/tailwind.css" rel="stylesheet" />
<link rel="stylesheet" href="/css/blogs.css" />
<link rel="stylesheet" href="/css/blog.css" />
<script async defer src="https://buttons.github.io/buttons.js"></script>
</head>
<body class="sm:bg-gray-100">
<header>
<nav class="container">
<a href="/">
<img alt="simplex logo" class="logo" src="/img/simplex.svg" />
</a>
<div class="nav__buttons">
<div class="github">
<a class="github-button" href="https://github.com/simplex-chat/simplex-chat" data-size="large"
data-show-count="true" aria-label="Star simplex-chat on GitHub">Star</a>
</div>
<div class="donate d-none-576">
<a href="https://opencollective.com/simplex-chat" target="_blank"> <span class="button">Donate</span></a>
</div>
</div>
</nav>
</header>
<section class="container">
<div class="bg-white py-6 sm:py-12 sm:px-8 md:px-16 lg:px-20">{{ content | safe }}</div>
</section>
<footer>
<div class="container">
<img alt="simplex logo" class="logo d-none-992" src="/img/simplex.svg" />
<p class="copyright">
&#169; 2020-22 SimpleX | Open-Source Project <span class="d-none-576">|</span>
<a class="d-none-576" href="https://github.com/simplex-chat" target="_blank"><img
src="/img/icons/github.svg" /></a>
<a class="d-none-576" href="https://www.reddit.com/r/SimpleXChat/" target="_blank"><img
src="/img/icons/reddit.svg" /></a>
<a class="d-none-576" href="https://twitter.com/simplexchat" target="_blank"><img
src="/img/icons/twitter.svg" /></a>
<a class="d-none-576" href="https://www.linkedin.com/company/simplex-chat/" target="_blank"><img
src="/img/icons/linkedin.svg" /></a>
<a class="d-none-576" href="mailto:chat@simplex.chat" target="_blank"><img src="/img/icons/email.svg" /></a>
</p>
<div class="github d-none-992">
<a class="github-button" href="https://github.com/simplex-chat/protocol" data-size="large"
data-show-count="true" aria-label="Star simplex-chat on GitHub">Star</a>
</div>
</div>
</footer>
<script>
const h1 = document.querySelectorAll("h1");
const h2 = document.querySelectorAll("h2");
const h3 = document.querySelectorAll("h3");
const h = [...h1, ...h2, ...h3];
h.forEach((h) => {
h.setAttribute("id", `${h.innerText.split(" ").join("-").toLowerCase()}`);
});
window.addEventListener("click", (e) => {
if (e.target.tagName === "A") {
e.preventDefault();
if (e.target.getAttribute("href").split("#")[0] == "") {
const id = e.target.getAttribute("href").split("#")[1];
const element = document.getElementById(id);
const yOffset = 0; // Offset for fixed header
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
window.scrollTo({
top: y,
behavior: 'smooth'
});
}
else {
window.open(e.target.href, "_self");
}
}
});
// convert relative blog links to absolute links
document.querySelectorAll("a").forEach((a) => {
const dotSepList = a.getAttribute("href").split(".");
if (dotSepList[0] == "") {
const hashSepList = dotSepList[dotSepList.length - 1].split("#")
if (hashSepList[0] == "md") {
let str = `/blog${dotSepList[1]}`;
for (let i = 2; i < dotSepList.length; i++) {
if (dotSepList[i].substring(0, 2) != "md") {
str += "." + dotSepList[i];
} else break;
}
if (hashSepList[1]) {
str += "#" + hashSepList[1];
}
a.setAttribute("href", str);
}
}
});
const url = window.location.href;
const hash = url.split("#")[1];
if (hash) {
console.log("entered")
const element = document.getElementById(hash);
const yOffset = 0; // Offset for fixed header
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
window.scrollTo({
top: y,
behavior: 'smooth'
});
}
</script>
</body>
</html>