Tidy up paths

This commit is contained in:
NBTX
2019-08-24 18:01:57 +01:00
parent 424df8c1ae
commit d86b2c410f
2 changed files with 28 additions and 15 deletions

View File

@@ -4,7 +4,7 @@
<h2>{{ error.message }}</h2> <h2>{{ error.message }}</h2>
<br> <br>
<p><nuxt-link to="/"><button>Go Home</button></nuxt-link></p> <p><nuxt-link to="/"><button>Go Home</button></nuxt-link></p>
<p><a href="/">Reload</a></p> <p><a :href="base">Reload</a></p>
</div> </div>
</template> </template>
@@ -22,8 +22,17 @@
</style> </style>
<script> <script>
import { routerBase } from '../nuxt.config';
export default { export default {
props: ['error'], props: ['error'],
data () {
return {
base: routerBase.router.base
}
},
head () { head () {
return { return {
bodyAttrs: { bodyAttrs: {

View File

@@ -1,7 +1,7 @@
// Some helpful application constants. // Some helpful application constants.
// TODO: Use these when rendering the pages (rather than just for head/meta tags...) // TODO: Use these when rendering the pages (rather than just for head/meta tags...)
const meta = { export const meta = {
name: "Postwoman", name: "Postwoman",
shortDescription: "Lightweight API request builder", shortDescription: "Lightweight API request builder",
description: "The Postwoman API request builder helps you create your requests faster, saving you precious time on your development." description: "The Postwoman API request builder helps you create your requests faster, saving you precious time on your development."
@@ -12,12 +12,16 @@ const meta = {
// -- Travis includes the author in the repo slug, // -- Travis includes the author in the repo slug,
// so if there's a /, we need to get everything after it. // so if there's a /, we need to get everything after it.
let repoName = process.env.TRAVIS_REPO_SLUG.split('/').pop() || ''; let repoName = (process.env.TRAVIS_REPO_SLUG || '').split('/').pop();
const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? { export const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? {
router: { router: {
base: `/${repoName}/` base: `/${repoName}/`
} }
} : {}; } : {
router: {
base: '/'
}
};
export default { export default {
mode: 'spa', mode: 'spa',
@@ -34,7 +38,7 @@ export default {
{ name: 'X-UA-Compatible', content: "IE=edge, chrome=1" }, { name: 'X-UA-Compatible', content: "IE=edge, chrome=1" },
{ itemprop: "name", content: `${meta.name} \u2022 ${meta.shortDescription}` }, { itemprop: "name", content: `${meta.name} \u2022 ${meta.shortDescription}` },
{ itemprop: "description", content: meta.description }, { itemprop: "description", content: meta.description },
{ itemprop: "image", content: "icons/icon-192x192.png" }, { itemprop: "image", content: `${routerBase.router.base}icons/icon-192x192.png` },
// Add to homescreen for Chrome on Android. Fallback for PWA (handled by nuxt) // Add to homescreen for Chrome on Android. Fallback for PWA (handled by nuxt)
{ name: 'application-name', content: meta.name }, { name: 'application-name', content: meta.name },
@@ -45,7 +49,7 @@ export default {
{ name: 'apple-mobile-web-app-title', content: meta.name }, { name: 'apple-mobile-web-app-title', content: meta.name },
// Windows phone tile icon // Windows phone tile icon
{ name: 'msapplication-TileImage', content: 'icons/icon-144x144.png' }, { name: 'msapplication-TileImage', content: `${routerBase.router.base}icons/icon-144x144.png` },
{ name: 'msapplication-TileColor', content: '#121212' }, { name: 'msapplication-TileColor', content: '#121212' },
{ name: 'msapplication-tap-highlight', content: 'no' }, { name: 'msapplication-tap-highlight', content: 'no' },
@@ -55,7 +59,7 @@ export default {
{ property: 'og:type', content: 'website' }, { property: 'og:type', content: 'website' },
{ property: 'og:title', content: `${meta.name} \u2022 ${meta.shortDescription}` }, { property: 'og:title', content: `${meta.name} \u2022 ${meta.shortDescription}` },
{ property: 'og:description', content: meta.description }, { property: 'og:description', content: meta.description },
{ property: 'og:image', content: `${routerBase.router.base}/icons/icon-144x144.png` }, { property: 'og:image', content: `${routerBase.router.base}icons/icon-144x144.png` },
// Twitter // Twitter
{ name: 'twitter:card', content: "summary" }, { name: 'twitter:card', content: "summary" },
@@ -64,18 +68,18 @@ export default {
{ name: 'twitter:url', content: "https://liyasthomas.github.io/postwoman" }, { name: 'twitter:url', content: "https://liyasthomas.github.io/postwoman" },
{ name: 'twitter:title', content: meta.name }, { name: 'twitter:title', content: meta.name },
{ name: 'twitter:description', content: meta.shortDescription }, { name: 'twitter:description', content: meta.shortDescription },
{ name: 'twitter:image', content: `${routerBase.router.base}/icons/icon-144x144.png` }, { name: 'twitter:image', content: `${routerBase.router.base}icons/icon-144x144.png` },
], ],
link: [ link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }, { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' },
// Home-screen icons (iOS) // Home-screen icons (iOS)
{ rel: 'apple-touch-icon', href: `${routerBase.router.base}/icons/icon-48x48.png` }, { rel: 'apple-touch-icon', href: `${routerBase.router.base}icons/icon-48x48.png` },
{ rel: 'apple-touch-icon', sizes: '72x72', href: `${routerBase.router.base}/icons/icon-72x72.png` }, { rel: 'apple-touch-icon', sizes: '72x72', href: `${routerBase.router.base}icons/icon-72x72.png` },
{ rel: 'apple-touch-icon', sizes: '96x96', href: `${routerBase.router.base}/icons/icon-96x96.png` }, { rel: 'apple-touch-icon', sizes: '96x96', href: `${routerBase.router.base}icons/icon-96x96.png` },
{ rel: 'apple-touch-icon', sizes: '144x144', href: `${routerBase.router.base}/icons/icon-144x144.png` }, { rel: 'apple-touch-icon', sizes: '144x144', href: `${routerBase.router.base}icons/icon-144x144.png` },
{ rel: 'apple-touch-icon', sizes: '192x192', href: `${routerBase.router.base}/icons/icon-192x192.png` }, { rel: 'apple-touch-icon', sizes: '192x192', href: `${routerBase.router.base}icons/icon-192x192.png` },
] ]
}, },
/* /*
@@ -119,7 +123,7 @@ export default {
for(let size of sizes){ for(let size of sizes){
icons.push({ icons.push({
"src": `${routerBase.router.base}/icons/icon-${size}x${size}.png`, "src": `${routerBase.router.base}icons/icon-${size}x${size}.png`,
"type": "image/png", "type": "image/png",
"sizes": `${size}x${size}` "sizes": `${size}x${size}`
}); });