1

У меня вот есть проект, делал по тутору akella: https://github.com/merrymaker14/vuegl Решил залить на GitHub Pages. https://merrymaker14.github.io/vuegl

Но он по страницам нормально не переходит, хотя вроде все настроил. Почему?

nuxt.config.js:

import pkg from './package'

/* nuxt.config.js */
// only add `router.base = '/<repository-name>/'` if `DEPLOY_ENV` is `GH_PAGES`
const routerBase = process.env.DEPLOY_ENV === 'GH_PAGES' ? {
  router: {
    base: '/vuegl/'
  }
} : {}

export default {
  mode: 'universal',

  /*
  ** Headers of the page
  */
  head: {
    title: pkg.name,
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: pkg.description }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },

  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },

  ...routerBase,

  router: {
     middleware: 'pages',
     //base: '/examples/vuegl/'
  },

  /*
  ** Global CSS
  */
  css: [
  ],

  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
  ],

  /*
  ** Nuxt.js modules
  */
  modules: [
  ],

  /*
  ** Build configuration
  */
  build: {
    /*
    ** You can extend webpack config here
    */
    extend(config, ctx) {
    }
  }
}

1 ответ 1

1
<template>
    <div class="navigation">
    <nuxt-link to="/">Homepage</nuxt-link>
    <nuxt-link to="/about">About</nuxt-link>
    <nuxt-link to="/another">another</nuxt-link>
    </div>
</template>

У вас ссылки относительные.

Вам надо ссылки явно указать, а то относительные ссылки на GHPages не работают.

<template>
    <div class="navigation">
    <nuxt-link to="https://merrymaker14.github.io/vuegl/">Homepage</nuxt-link>
    <nuxt-link to="https://merrymaker14.github.io/vuegl/about">About</nuxt-link>
    <nuxt-link to="https://merrymaker14.github.io/vuegl/another">another</nuxt-link>
    </div>
</template>
2
  • Не, так не работает, он прибавляет, становится что-то вроде: merrymaker14.github.io/vuegl/https://merrymaker14.github.io/…" 11 апр 2019 в 15:22
  • 1
    Окей тогда, учитывая то что старые ссылки переводят на merrymaker.github.io поставьте тогда /vuegl, /vuelgl/about и так далее.
    – vladimirch
    11 апр 2019 в 15:29

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.