Added sitemap for humans and bots. Some content tweaks. Starting to feel close to done!

This commit is contained in:
Hyperling 2022-10-19 04:56:51 -05:00
parent 3cf1665197
commit 471d5e1573
9 changed files with 154 additions and 27 deletions

View File

@ -27,10 +27,8 @@ Then in a web browser, navigate to `your_machines_ip_address:8080`.
## TODO
Add New Content
- NOTICE
- HEALTH (My Priorities Sheet)
- How to host files? Put them in reverse-proxy's files.hyperling.com site?
- STANCE
- JOURNEY
## Inspiration

105
main.js
View File

@ -29,9 +29,15 @@ ports.push(8080);
//// Functions ////
/* Code exists inside a main function so that we may use async/await.
*/
async function main() {
console.log("...Starting Main...");
// Getting dates in Node.js is awful, just use Linux.
const start_datetime = "" + await execSync('date "+%Y-%m-%dT%H:%M:%S%:z"');
const start_datetime_trimmed = start_datetime.trim();
console.log("Set app to return HTML documents.");
app.use(function (req, res, next) {
res.contentType('text/html');
@ -59,28 +65,113 @@ async function main() {
console.log(" * Pages loaded: ", pages);
//return; // Stop execution FORTESTING
/* Create both an XML and HTML sitemap based on these entries. XML is used for
// bots like SEO scrapers. HTML will be for human users looking for a list of
// all pages. Some are not in the menu. Generated an example XML sitemap at
// www.xml-sitemaps.com then stripped it apart and made it dynamic.
*/
let sitemap_xml = `<?xml version="1.0" encoding="UTF-8"?>
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
>
<url>
<loc>https://hyperling.com/</loc>
<lastmod>`+start_datetime_trimmed+`</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://hyperling.com/sitemap/</loc>
<lastmod>`+start_datetime_trimmed+`</lastmod>
<priority>0.80</priority>
</url>
`;
let sitemap_html = `
<html><body>
<strong>Special Pages</strong>
<ul>
<li>
<b>Main Site</b>
(<a href="/">Local</a>)
(<a href="https://`+app_name+`/">Hardlink</a>)
</li>
<li>
<b>XML Site Map</b>
(<a href="/sitemap.xml">Local</a>)
(<a href="https://`+app_name+`/sitemap.xml">Hardlink</a>)
</li>
<li>
<b>HTML Site Map</b>
(<a href="/sitemap/">Local</a>)
(<a href="https://`+app_name+`/sitemap/">Hardlink</a>)
<i>[You are here!]</i>
</li>
</ul>
<strong>Web Pages (Alphabetical)</strong>
<ul>
`;
console.log("...Adding Routes...");
let router = express.Router();
/* AUTOMATIC METHOD BASED ON OBJECT/ARRAY OF PHP scripts
/* AUTOMATIC METHOD BASED ON OBJECT/ARRAY OF WEB SCRIPTS
// Creates routes with the URL of the key and location of the value.
*/
for (let key in pages) {
console.log(" * Creating router for", key);
router.get("/" + key, function (req,res) {
console.log(key, "fulfilling request to", req.socket.remoteAddress, "asking for", req.url)
res.send(execSync(pages[key]));
res.send("" + execSync(pages[key]));
});
/* Append the page to the sitemap variables.
*/
console.log(" * * Adding to sitemap.xml");
sitemap_xml = sitemap_xml + `
<url>
<loc>https://hyperling.com/`+key+`/</loc>
<lastmod>`+start_datetime_trimmed+`</lastmod>
<priority>0.80</priority>
</url>
`;
console.log(" * * Adding to sitemap.html");
sitemap_html = sitemap_html + `
<li>
<b>`+key+`</b>
(<a href="/`+key+`/">Local</a>)
(<a href="https://`+app_name+`/`+key+`/">Hardlink</a>)
</li>
`;
}
// Provide css.
router.get('/main.css', function (req, res) {
console.log("css being provided to", req.socket.remoteAddress)
let html = execSync("cat ./pages/main.css");
res.send(html);
/* Close the sitemap variables
*/
sitemap_xml = sitemap_xml + `
</urlset>
`;
sitemap_html = sitemap_html + `
</ul></body></html>
`;
// Provide sitemap.xml file for "SEO".
console.log(" * Creating router for sitemap.xml");
router.get('/sitemap.xml', function (req, res) {
console.log("sitemap.xml being provided to", req.socket.remoteAddress)
res.contentType('text/xml');
res.send(sitemap_xml);
});
// Provide human-usable sitemap links.
console.log(" * Creating router for sitemap*");
router.get('/sitemap*', function (req, res) {
console.log("sitemap.html being provided to", req.socket.remoteAddress)
res.send(sitemap_html);
});
// Originally a test, now a catch-all redirection to Home!
console.log(" * Creating router for redirection");
router.get('/*', function (req, res) {
// WARNING: These are huge so only look when you need to.
//console.log(req);

View File

@ -36,20 +36,19 @@
</p>
-->
<p>
Currently I reside in the US state of Indiana and am working to move
As of 2022 I reside in the US state of Indiana and am working to move
to the southwest for the following reasons:
</p>
<ul>
<li>Dry Heat</li>
<li>Dry Climate</li>
<li>Mountains</li>
<li>Lack of Bugs</li>
<li>Cactus and Spruce</li>
<li>Permaculture Possibilities</li>
<li>Native Cactus and/or Spruce</li>
</ul>
<p>
The search will begin in Arizona. Colorado and Mexico will likely
be explored. New Mexico and other locations will be visited as well
but have not yet revealed areas which offer exactly what I'm looking
for.
be explored. New Mexico and other locations will be visited as well.
</p>
</div>
</div>

View File

@ -4,7 +4,7 @@
?>
<div class="row">
<h2 class="col-12 title">Contact Me</h2>
<h1 class="col-12 title">Contact Me</h1>
</div>
<div class="row">
<div class="col-12 text">

View File

@ -1 +1,4 @@
#!/usr/bin/php
<div class="row" id="advisory">
<!-- No advisories at this moment. -->
</div>

View File

@ -2,10 +2,15 @@
<?php
include "menu.php"
?>
<h6 class="center">
<a href="https://github.com/Hyperling/www/blob/main/LICENSE"
target="_blank" rel="noopener noreferrer"
>
This website is free software! Click to learn more.
</a>
</h6>
<div class="row" id="footer">
<div class="col-3"></div>
<h6 class="col-3 center">
<a href="https://github.com/Hyperling/www/blob/main/LICENSE"
target="_blank" rel="noopener noreferrer"
>This website is free software! Click to learn more.</a>
</h6>
<h6 class="col-3 center">
<a href="/sitemap/">Full Site Map</a>
</h6>
<div class="col-3"></div>
</div>

View File

@ -1 +1,27 @@
#!/bin/bash
# Move to the directory that this file is in.
cd `dirname $0`
# Create the necessary HTML components for a web page.
./helpers/body_open.php
#Content for this page
cat << EOF
<div class="row">
<h1 class="col-12 title">
My Journey
</h1>
<p class="col-12 text">
[ TBD, check back soon. ]
</p>
</div>
EOF
# Any subpages
###./helpers/section_open.php
###./subpages/journey/???
###./helpers/section_close.php
# Finish the web page
./helpers/body_close.php

View File

@ -11,7 +11,7 @@
</div>
<div class="row text center">
<div class="col-3">
<div class="col-6">
<figure>
<a href="https://play.google.com/store/apps/details?id=com.hyperling.carbupbeta"
target="_blank" rel="noopener noreferrer">
@ -40,7 +40,7 @@
</figure>
</div>
<div class="col-3">
<div class="col-6">
<figure>
<a href="https://play.google.com/store/apps/details?id=com.hyperling.apps.the45minuterule"
target="_blank" rel="noopener noreferrer">
@ -69,7 +69,7 @@
</figure>
</div>
<div class="col-3">
<div class="col-6">
<figure>
<a href="https://play.google.com/store/apps/details?id=com.hyperling.apps.infinitetimer"
target="_blank" rel="noopener noreferrer"
@ -99,7 +99,7 @@
</figure>
</div>
<div class="col-3">
<div class="col-6">
<figure>
<a href="https://play.google.com/store/apps/details?id=apps.hyperling.com.platformer"
target="_blank" rel="noopener noreferrer"

View File

@ -28,6 +28,11 @@
>
Long Grain White Rice</a> (if jasmine is still out of stock)
</li>
<li><a href="https://foodtolive.com/shop/organic-green-lentils/"
target="_blank" rel="noopener noreferrer"
>
Lentils</a> (prefer green or brown)
</li>
<li><a href="https://foodtolive.com/shop/organic-tri-color-quinoa/"
target="_blank" rel="noopener noreferrer"
>