1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2025-04-26 14:08:29 -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": [ "ignorePatterns": [
"public/**", "public/**",
"static/assets/**", "static/assets/**"
"gulpfile.js",
"webpack.config.js"
] ]
} }

View File

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

View File

@ -22,7 +22,7 @@ if (wrapper && canonical) {
wrapper.style.display = "inline-flex"; wrapper.style.display = "inline-flex";
// get path and strip beginning and ending forward slash // 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)}`) fetch(`/api/hits/?slug=${encodeURIComponent(slug)}`)
.then((response) => response.json()) .then((response) => response.json())

View File

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

View File

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