commit 39c2ec1d7e1f58be82306377f49f9b053e0c0766
parent a04469b216a7f5f64f804b913b52ef72d713f478
Author: Beau Hilton <beau.hilton@vumc.org>
Date: Thu, 5 Aug 2021 12:47:35 -0500
test dynamic title renaming
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/_header.html b/_header.html
@@ -4,6 +4,14 @@
<link rel="alternate" type="application/atom+xml" href="/rss.xml">
<link rel="stylesheet" href="/style.css">
<link rel="icon" href="https://git.beauhilton.com/logo.png">
+<title id="title">.</title>
+<script type="text/javascript">
+ var url = window.location.pathname; // gets the pathname of the file
+ var str = url.substring(url.lastIndexOf('/')+1); // removes everything before the filename
+ str = str.substring(0, str.length - 5); // removes the extension
+ var filename = str.replace(/%20/g, " "); // if the filename has multiple words separated by spaces, browsers do not like that and replace each space with a %20. This replace %20 with a space.
+ document.getElementById("title").innerHTML = filename;
+</script>
</head>
<meta charset="utf-8">
<body id="home">
@@ -12,4 +20,3 @@
</section>
-