Properly update link depending on branch

This commit is contained in:
Violet 2024-04-16 19:38:32 +00:00 committed by GitHub
parent 7aa9ba6311
commit a65c5c129e
2 changed files with 16 additions and 1 deletions

View file

@ -17,6 +17,10 @@ var lanyardData = undefined
var uptime = Date.now()
function firstToUpper(str) {
return str.charAt(0).toUpperCase() + str.slice(1)
}
function converter(html, query) {
while (html.includes("{PATH_")) {
var pagePath = html.substring(html.indexOf("{PATH_"))
@ -46,7 +50,17 @@ function converter(html, query) {
var time = new Date(Date.now())
var bnchName = "Beta"
var bnchSub = "beta."
if (process.env.BRANCH == "dev") {
bnchName = "Stable"
bnchSub = ""
}
var replacers = {
"BRANCH_NAME": bnchName,
"BRANCH_SUB": bnchSub,
"COMMIT_COUNT": commitCount,
"RANDOM_QUOTE": quotes[Math.floor(Math.random() * quotes.length)],
"QUOTE_COUNT": quotes.length,

View file

@ -47,8 +47,9 @@
<p style="padding: 10px;">Hi! I'm Violet, a 15 year old web and game developer. I aspire to make server-sided dynamic websites, with no Javascript required! I'm currently making games in the Godot Engine, and my dynamic sites in NodeJS.</p>
<a class="chip" href="./socials/">Socials</a>
<a class="chip" href="./faq">Nerd FAQ</a>
<a class="chip" href="./stats">Stats</a>
<br>
<a class="chip" href="https://beta.violets-purgatory.dev">Beta site</a>
<a class="chip" href="https://{BRANCH_SUB}violets-purgatory.dev">{BRANCH_NAME} site</a>
<a class="chip" href="https://blog.violets-purgatory.dev">Blog</a>
<a class="chip" href="https://fs.violets-purgatory.dev">FileShare</a>