diff --git a/.github/workflows/deployment.yaml b/.github/workflows/deployment.yaml index 3a931d378063..52a0f9c1e38b 100644 --- a/.github/workflows/deployment.yaml +++ b/.github/workflows/deployment.yaml @@ -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 diff --git a/content/_data/constants.yml b/content/_data/constants.yml index ac8437bea84f..ae6426e6b6f5 100644 --- a/content/_data/constants.yml +++ b/content/_data/constants.yml @@ -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 diff --git a/package.json b/package.json index eb6036cb4cd5..54b0f8b62ad6 100644 --- a/package.json +++ b/package.json @@ -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" }, diff --git a/src/utils/url.js b/src/utils/url.js index b9c26ddc06ed..ee5a99c2165e 100644 --- a/src/utils/url.js +++ b/src/utils/url.js @@ -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 } @@ -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) }