Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Build site using Jekyll
env:
JEKYLL_ENV: production
run: npm run-script jekyll:build -- --baseurl ${{ github.event.repository.name }}
run: npm run-script jekyll:build

- name: Upload artifact
id: deployment
Expand Down
4 changes: 2 additions & 2 deletions content/_data/constants.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ header_nav:
links:
about:
title: Read more about FiQCI
href: /dev/about
href: /about
access:
title: How to get access
href: /dev/access
href: /access

access_cards:
- title: Quantum computers
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"jekyll:serve": "npm run-script jekyll -- serve --config ${npm_package_config_jekyll_configFilename},${npm_package_config_jekyll_webpackConfigFilename}",
"jekyll:build": "npm run-script jekyll -- build --config ${npm_package_config_jekyll_configFilename},${npm_package_config_jekyll_webpackConfigFilename}",
"clean": "npm run-script jekyll -- clean --config ${npm_package_config_jekyll_configFilename},${npm_package_config_jekyll_webpackConfigFilename} && rm ${npm_package_config_jekyll_webpackConfigFilename}",
"watch": "npx concurrently --kill-others --prefix-colors ${npm_package_config_conc_colors} --passthrough-arguments 'npm:tailwindcss -- {1}' 'npm:webpack -- --mode=development {1}' 'npm:jekyll:serve -- --livereload --baseurl /dev/' -- --watch",
"watch": "npx concurrently --kill-others --prefix-colors ${npm_package_config_conc_colors} --passthrough-arguments 'npm:tailwindcss -- {1}' 'npm:webpack -- --mode=development {1}' 'npm:jekyll:serve -- --livereload' -- --watch",
"build": "npm run-script tailwindcss && npm run-script webpack -- --mode=production && npm run-script jekyll:build",
"start": "npm run-script tailwindcss && npm run-script webpack -- --mode=development && npm run-script jekyll:serve"
},
Expand Down
19 changes: 15 additions & 4 deletions src/utils/url.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
const prependToPathname = (href, value) => {
const url = URL.parse(href, window.location.origin)
const basepath = URL.parse(value, window.location.origin).pathname
const path = basepath.concat(url.pathname)
let basepath = URL.parse(value, window.location.origin).pathname
let pathname = url.pathname

// Remove trailing slash from basepath (unless it's just '/')
if (basepath.length > 1 && basepath.endsWith('/')) {
basepath = basepath.slice(0, -1)
}
// Remove leading slash from pathname
if (pathname.startsWith('/')) {
pathname = pathname.slice(1)
}

const path = basepath === '/' ? `/${pathname}` : `${basepath}/${pathname}`

return new URL(path, window.location.origin).pathname
}
Expand All @@ -19,7 +30,7 @@ export const isAnchor = href => {
}

export const prependBaseURL = href => {
if (isExternal(href) || isAnchor(href)) return href
if (isExternal(href) || isAnchor(href)) return href

return prependToPathname(href, SITE.deployment.baseURL)
return prependToPathname(href, SITE.deployment.baseURL)
}
Loading