themes/docsy/layouts/partials/edit-this-page.html (50 lines of code) (raw):

<div> {{ $File := .File }} {{ $Site := .Site }} {{ with $File.Path }} <div id="edit-github"> <svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" aria-hidden="true" style="margin-right: 0.1em;vertical-align: sub; color: #3176d9"> <g> <path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z" /> </g> </svg> <a class="github-link" title="Edit this page" href="" target="_blank"> <span id="edit-github-text">Edit this page</span> </a> </div> {{ end }} </div> <script> let reg = /\/docs\/[a-zA-Z\-]+\/([\w|\.]+)\//; let res = reg.exec(location.href); let version = res && res[1]; let editGithub = document.getElementById("edit-github"); if (editGithub) { editGithub.style.display = version === "next" ? "block" : "none"; } if (version === "next") { reg = /\/docs\/(.+?)\//; let repoRes = reg.exec(location.href); let repo = repoRes && repoRes[1]; if (repo === "main") { repo = "skywalking" } reg = /\/next\/(.+)/; let docs = reg.exec(location.href); let docsUrl = docs && docs[1]; if (docsUrl) { docsUrl = docsUrl.replace(/readme/i, 'README'); } let prefixUrl = "https://github.com/apache/" + repo + "/blob/master/docs/"; let editGithubLink = document.querySelector("#edit-github a"); if (editGithubLink) { editGithubLink.href = prefixUrl + docsUrl.replace(/\/$/, ".md"); } } </script>