Compare commits

...

2 Commits

Author SHA1 Message Date
6b72450c24 Added license and repository to package.json 2023-01-02 13:33:34 -08:00
0e71c26051 Added support for up to 5 links in header
Use SITE_LINK_NAME_n/SITE_LINK_URL_n environment variables to set the
links
2023-01-02 13:29:17 -08:00
3 changed files with 36 additions and 3 deletions

View File

@ -1,10 +1,15 @@
{
"name": "mma_website_docker",
"version": "0.1.0",
"version": "0.2.0",
"description": "Generic Website",
"author": "Mahesh Asolkar <mahesh@mahesha.com>",
"main": "website.js",
"scripts": {
"start": "node website.js"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "https://git.heshapps.com/asolkar/mma-website.git"
}
}

View File

@ -18,6 +18,25 @@ module.exports = {
ret.title = process.env.SITE_TITLE;
}
// Links on the site header
var links = [];
if (("SITE_LINK_NAME_1" in process.env) && ("SITE_LINK_URL_1" in process.env)) {
links.push({'name': process.env.SITE_LINK_NAME_1, 'url': process.env.SITE_LINK_URL_1});
}
if (("SITE_LINK_NAME_2" in process.env) && ("SITE_LINK_URL_2" in process.env)) {
links.push({'name': process.env.SITE_LINK_NAME_2, 'url': process.env.SITE_LINK_URL_2});
}
if (("SITE_LINK_NAME_3" in process.env) && ("SITE_LINK_URL_3" in process.env)) {
links.push({'name': process.env.SITE_LINK_NAME_3, 'url': process.env.SITE_LINK_URL_3});
}
if (("SITE_LINK_NAME_4" in process.env) && ("SITE_LINK_URL_4" in process.env)) {
links.push({'name': process.env.SITE_LINK_NAME_4, 'url': process.env.SITE_LINK_URL_4});
}
if (("SITE_LINK_NAME_5" in process.env) && ("SITE_LINK_URL_5" in process.env)) {
links.push({'name': process.env.SITE_LINK_NAME_5, 'url': process.env.SITE_LINK_URL_5});
}
ret.links = links;
return ret;
},
site_ga_stub: function (req) {

View File

@ -17,7 +17,7 @@ function getPage(req) {
console.log(`Serving route ${route}`);
return `<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
var page = `<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head>
<title>${website.title}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
@ -255,7 +255,14 @@ function toggle_play () {
</script>
</head><body onload="initialize()">
<div id="nav_strip">
<a href="${website.url}" title="Home">Home</a>
<a href="${website.url}" title="Home">Home</a>`;
website.links.forEach((lnk) => {
page += `
&bull; <a href="${lnk.url}" title="${lnk.name}">${lnk.name}</a>`;
});
page += `
</div>
<div id="osc_txt">
${website.name}
@ -280,6 +287,8 @@ ${ga_tracking_stub}
</body>
</html>`;
return page;
}
// ----------------------------------------------------------------------