1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 08:45:26 -04:00

fix canonical URL edge case

This commit is contained in:
Jake Jarvis 2021-10-03 12:28:27 -04:00
parent 013550c1f9
commit bb8e5e2248
Signed by: jake
GPG Key ID: 2B0C9CF251E69A39
5 changed files with 46 additions and 25 deletions

View File

@ -50,8 +50,6 @@
}],
"ignorePatterns": [
"public/**",
"static/assets/**",
"gulpfile.js",
"webpack.config.js"
"static/assets/**"
]
}

View File

@ -13,13 +13,8 @@ _vendor/
# dotfiles/config
.*
postcss.config.js
webpack.config.js
gulpfile.js
babel.config.json
# miscellaneous
vercel.json
.vercel/
.github/
.lighthouseci/

View File

@ -22,7 +22,7 @@ if (wrapper && canonical) {
wrapper.style.display = "inline-flex";
// get path and strip beginning and ending forward slash
const slug = urlParse(canonical.href).pathname.replace(/^\/|\/$/g, "");
const slug = urlParse(canonical).pathname.replace(/^\/|\/$/g, "");
fetch(`/api/hits/?slug=${encodeURIComponent(slug)}`)
.then((response) => response.json())

View File

@ -1,14 +1,20 @@
{
"name": "jarvis",
"alias": [ "jarv.is", "www.jarv.is" ],
"alias": ["jarv.is", "www.jarv.is"],
"public": false,
"trailingSlash": true,
"cleanUrls": false,
"rewrites": [
{ "source": "/favicon.ico", "destination": "/assets/images/favicon.ico" },
{ "source": "/apple-touch-icon.png", "destination": "/assets/images/apple-touch-icon.png" },
{ "source": "/apple-touch-icon-precomposed.png", "destination": "/assets/images/apple-touch-icon.png" },
{ "source": "/api/csp_wizard/", "destination": "https://jarvis.report-uri.com/r/d/csp/enforce" },
{
"source": "/apple-touch-icon-precomposed.png",
"destination": "/assets/images/apple-touch-icon.png"
},
{
"source": "/api/csp_wizard/",
"destination": "https://jarvis.report-uri.com/r/d/csp/enforce"
},
{ "source": "/api/report/", "destination": "https://jarvis.report-uri.com/a/d/g" },
{ "source": "/api/mention/", "destination": "https://webmention.io/jarv.is/webmention" },
{ "source": "/api/ping/", "destination": "https://webmention.io/jarv.is/xmlrpc" }
@ -20,14 +26,37 @@
{ "source": "/rss/", "destination": "/feed.xml", "permanent": true },
{ "source": "/blog/(.*)", "destination": "/notes/", "permanent": true },
{ "source": "/archives/(.*)", "destination": "/notes/", "permanent": true },
{ "source": "/2013/11/21/no-homo-still-raps-motto/", "destination": "/notes/no-homo-still-raps-motto/", "permanent": true },
{ "source": "/2016/02/28/millenial-with-hillary-clinton/", "destination": "/notes/millenial-with-hillary-clinton/", "permanent": true },
{ "source": "/2018/12/04/how-to-shrink-linux-virtual-disk-vmware/", "destination": "/notes/how-to-shrink-linux-virtual-disk-vmware/", "permanent": true },
{ "source": "/2018/12/07/shrinking-a-linux-virtual-disk-with-vmware/", "destination": "/notes/how-to-shrink-linux-virtual-disk-vmware/", "permanent": true },
{ "source": "/2018/12/10/cool-bash-tricks-for-your-terminal-dotfiles/", "destination": "/notes/cool-bash-tricks-for-your-terminal-dotfiles/", "permanent": true },
{
"source": "/2013/11/21/no-homo-still-raps-motto/",
"destination": "/notes/no-homo-still-raps-motto/",
"permanent": true
},
{
"source": "/2016/02/28/millenial-with-hillary-clinton/",
"destination": "/notes/millenial-with-hillary-clinton/",
"permanent": true
},
{
"source": "/2018/12/04/how-to-shrink-linux-virtual-disk-vmware/",
"destination": "/notes/how-to-shrink-linux-virtual-disk-vmware/",
"permanent": true
},
{
"source": "/2018/12/07/shrinking-a-linux-virtual-disk-with-vmware/",
"destination": "/notes/how-to-shrink-linux-virtual-disk-vmware/",
"permanent": true
},
{
"source": "/2018/12/10/cool-bash-tricks-for-your-terminal-dotfiles/",
"destination": "/notes/cool-bash-tricks-for-your-terminal-dotfiles/",
"permanent": true
},
{ "source": "/resume/", "destination": "/resume.pdf" },
{ "source": "/jarvis.asc", "destination": "/pubkey.asc" },
{ "source": "/ios-trackers/(.*)", "destination": "https://jakejarvis.github.io/ios-trackers/$1" },
{
"source": "/ios-trackers/(.*)",
"destination": "https://jakejarvis.github.io/ios-trackers/$1"
},
{ "source": "/awesome/(.*)", "destination": "https://synonymsforawesome.com/" },
{ "source": "/scrabble/(.*)", "destination": "https://jakejarvis.github.io/scrabble/$1" }
],
@ -56,7 +85,7 @@
},
{
"source": "/(.*)",
"headers" : [
"headers": [
{
"key": "Onion-Location",
"value": "http://jarvis2i2vp4j4tbxjogsnqdemnte5xhzyi7hziiyzxwge3hzmh57zad.onion/$1"
@ -98,8 +127,8 @@
"value": "1; mode=block"
},
{
"key" : "X-Got-Milk",
"value" : "2%"
"key": "X-Got-Milk",
"value": "2%"
}
]
}

View File

@ -1,3 +1,4 @@
/* eslint-env node */
import path from "path";
import { fileURLToPath } from "url";
import webpack from "webpack";
@ -146,9 +147,7 @@ export default {
}),
postcssFocus(),
postcssColorRgbaFallback({
properties: [
"background-image",
],
properties: ["background-image"],
}),
postcssCombineDuplicatedSelectors(),
postcssMergeRules(),
@ -171,7 +170,7 @@ export default {
type: "asset/resource",
generator: {
filename: "fonts/[name][ext]",
}
},
},
],
},