Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to GitHub Pages: Improve doc for generic base URL config and favicon working on <owner>.github.io/<repository>/ #1776

Open
mhoffrog opened this issue Feb 1, 2025 · 0 comments · May be fixed by #1781

Comments

@mhoffrog
Copy link
Contributor

mhoffrog commented Feb 1, 2025

Proposal for Improvement

Current doc of Deploy Nuxt to GitHub Pages / github-pages.md should be enhanced by the following helpful details:

  1. Add a hint to generically set NUXT_APP_BASE_URL within a GitHub Action by:
    NUXT_APP_BASE_URL="/${GITHUB_REPOSITORY##*/}/" - so it works for any repo oob.

  2. Give an example how to make favicon working in any case - for a custom domain as well as for hosting on <owner|organization>.github.io within nuxt.config.ts:

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  app: {
    head: {
      title: "My Page Title",
      link: [
        // https://nuxt.com/deploy/github-pages and https://vite.dev/guide/env-and-mode.html for details.
        // !!! Make use of compile time environment var NUXT_APP_BASE_URL to work for GitHub Pages deployments as well.
	// Assumption: favicon files in ~/public as ~/public/favicon.ico, ~/public/favicon-32x32.png etc.:
        {
          rel: "icon",
          type: "image/x-icon",
          href: (import.meta.env.NUXT_APP_BASE_URL ? import.meta.env.NUXT_APP_BASE_URL : "/") + "favicon.ico?x=2"
        },
        { 
          rel: "icon", type: "image/png", sizes: "32x32",
          href: (import.meta.env.NUXT_APP_BASE_URL ? import.meta.env.NUXT_APP_BASE_URL : "/") + "favicon-32x32.png"
        },
       // ... add probable other icon variants accordingly
      ],
    },
  },
  // ... continue with existing config
});
mhoffrog added a commit to mhoffrog/nuxt.com that referenced this issue Feb 4, 2025
- add hint to use GitHub Actions GITHUB_REPOSITORY variable
- add paragraph how to get favicons working on a GitHub Pages deployment

closes nuxt#1776
mhoffrog added a commit to mhoffrog/nuxt.com that referenced this issue Feb 4, 2025
- Add hint to use GitHub Actions GITHUB_REPOSITORY variable
- Add paragraph how to get favicons working on a GitHub Pages deployment

closes nuxt#1776
@mhoffrog mhoffrog linked a pull request Feb 5, 2025 that will close this issue
6 tasks
mhoffrog added a commit to mhoffrog/nuxt.com that referenced this issue Feb 10, 2025
- Add hint to use GitHub Actions GITHUB_REPOSITORY variable
- Add paragraph how to get favicons working on a GitHub Pages deployment

closes nuxt#1776
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant