GithubHelp home page GithubHelp logo

vite-plugin-pages-sitemap's Introduction

Hi there, I'm JB Aubrée 👋

I'm a Front-end Developer, VueJS, UnoCSS, Vite lover.


jbaubree's GitHub stats


Top Langs

vite-plugin-pages-sitemap's People

Contributors

jbaubree avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

sondh0127 ange007

vite-plugin-pages-sitemap's Issues

Is it ready or working its not working even call plugin

This plugin in not working, and it is not even generating static routes

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import firebase from 'firebase'
import Pages from 'vite-plugin-pages'
import generateSitemap from 'vite-plugin-pages-sitemap'

// https://vitejs.dev/config/
export default defineConfig({
  // base: '/deploy',
  plugins: [
    vue(),
    Pages({
      onRoutesGenerated: async (routes) => {
        // let data = []
        // const db = firebase.firestore()

        // // retrieve a collection
        // db.collection('BlockList')
        //   .orderBy('time', 'desc')
        //   .onSnapshot((snapshotChange) => {
        //     snapshotChange.forEach((doc) => {
        //       data.push({
        //         key: doc.id,
        //       })
        //       console.log(doc.id)
        //     })
        //   })
        // console.log(JSON.stringify(data))
        // // const users = await api.get('/users')
        // const dynamicRoutes = data.map((x) => `/block/${x.key}`)
        console.log('routes', routes)
        generateSitemap({
          hostname: 'https://myquiltblocks.com/',
          // routes: [...routes, ...dynamicRoutes],
          routes: [...routes],
          readable: true,
          exclude: [],
          allowRobots: true,
        })
      },
    }),
  ],
})


Sitemap not generating

After updating my dependency's, the sitemap doesn't generate anymore. After this experience I tested the example in your GitHub to test if something was wrong with my config. Unfortunately it wasn't the case the example also doesn't work.

Vite 3 support

The current state of the plugin doesn't support Vite 3

Need a little help getting it to work :(

I'm having a little trouble understanding and getting this to work.
All installed:
// package.json

"vue": "^3.2.31",
"vue-router": "^4.0.14"
"vite": "^2.9.1",
"vite-plugin-pages": "^0.23.0",
"vite-plugin-pages-sitemap": "^1.2.2"

// vite.config.js

import Pages from 'vite-plugin-pages'
import generateSitemap from 'vite-plugin-pages-sitemap'

export default defineConfig({
	plugins: [
		vue(),
		Pages({
			onRoutesGenerated: async(routes) => {
				generateSitemap({
				// hostname: 'https://mywebsite.com/',
				hostname: 'http://localhost:3000/',
				routes: [...routes],
				readable: true,
				})
			},
		}),

	],
})

Only have 2 pages, / and /menu.

Upon running npm run build I was expecting to see a generated sitemap.xml file 🤔

Also tried this routes: ['/', '/menu'],

What am I doing wrong?!

sitemap file is not generated!

Hello. Thank you for the plugin. It was definitely necessary to have a sitemap solution that works with vue 3 and vite.
I setup as instructed but still cant see any sitemap file generated in the public folder of the project.
It also would be nice if you can give an example on how to use the options for example to change the default "hostname".

Nested routes are not generated in sitemap

Nested routes like examples given in: https://router.vuejs.org/guide/essentials/nested-routes.html do not work with sitemap. This is because

return [...options.routes.values()]
only looks at top level routes (expecting flat list of routes).

To see sample code on how to recurse through the nested routes:
https://github.com/antfu/vite-ssg/blob/3adec80118d6f008fd2f6ffafcc08cb0101284ce/src/node/utils.ts#L13

Work around is to flatten the hierarchy and pass it to generateSitemap, but supporting it natively would be awesome.

Sitemap generates and works locally. But doesn't work when deployed on firebase.

I am facing weird issue where I am able to generate the sitemap and run it locally using localhost:3000/sitemap.xml. I updated the hostname as shown below and when I run it locally I can see the sitemap with my domain name. But after deploying it to firebase the response is blank. Am I missing something? Please guide

onRoutesGenerated: (routes) =>
generateSitemap({
hostname: 'https://mydomainname.web.app/',
dest: 'public',
filename: 'sitemap.xml',
routes,
}),
}),

Missing hostname slash in routes

When you build the app sitemap.xml contains hostname <loc>http://localhost/</loc> with a slash on the end.
Every next <loc> looks like this <loc>http://localhostterms-and-privacy</loc> without the slash at the end of the hostname.

Workaround is to provide routes manually in vite.config.js routes: ['/', '/terms-and-privacy'] which is ok as long as you don't have many routes.

Sitemap.xml has not been generated

Hi,
the plug-in cannot generate sitemap for my website, i am building my website as following :

"dependencies": {
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-helmet": "^6.1.0",
    "react-router-dom": "^6.3.0",
    "zustand": "^4.0.0-rc.1"
  },
  "devDependencies": {
    "@types/react": "^18.0.0",
    "@types/react-dom": "^18.0.0",
    "@vitejs/plugin-react": "^1.3.0",
    "sass": "^1.52.3",
    "vite": "^3.0.9",
    "vite-plugin-pages": "^0.25.0",
    "vite-plugin-pages-sitemap": "^1.3.0"
  }

the .jsx which are the single pages are located in the src/views. Then i run npm run build to build the website, but i get nothing. my vite.config.js look like so:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import Pages from 'vite-plugin-pages'
import generateSitemap from 'vite-plugin-pages-sitemap'

export default defineConfig({
  plugins: [
    react(),
    Pages({
      dirs: 'src/views',
      onRoutesGenerated: routes =>
        generateSitemap({
          routes,
          readable: true,
          dest: 'public',
          filename: 'sitemap.xml'
        }),
    }),
  ],
  server: {
    host: true,
  },
})

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/ci.yml
  • actions/checkout v4
  • pnpm/action-setup v4
  • actions/setup-node v4
  • actions/checkout v4
  • pnpm/action-setup v4
  • actions/setup-node v4
npm
example/package.json
  • vue ^3.4.27
  • vue-router ^4.3.2
  • @vitejs/plugin-vue ^5.0.4
  • cross-env ^7.0.3
  • nodemon ^3.1.0
  • typescript ^5.4.5
  • vite ^5.2.11
  • vite-plugin-pages ^0.32.1
package.json
  • sitemap ^8.0.0
  • xml-formatter ^3.6.2
  • @antfu/eslint-config ^2.18.1
  • @antfu/utils ^0.7.8
  • @types/node ^20.12.12
  • @vitest/coverage-v8 ^1.6.0
  • eslint ^9.3.0
  • eslint-plugin-format ^0.1.1
  • pkgroll ^2.1.1
  • typescript ^5.4.5
  • vite ^5.2.11
  • vitest ^1.6.0
  • pnpm 9.4.0

  • Check this box to trigger a request for Renovate to run again on this repository

[Feature Request] Exclude routes page

Is there possible to customize robots disallow the routes page from the vite-plugin-pages?

And I have problem when generate dynamic routes from api there such an error too.

[vite-plugin-pages] Could not load /@vite-plugin-pages/generated-pages?id=virtual:generated-pages (imported by src/main.js): products.map is not a function
error during build:
TypeError: Could not load /@vite-plugin-pages/generated-pages?id=virtual:generated-pages (imported by src/main.js): products.map is not a function
    at Object.onRoutesGenerated (file:///D:/Project/Web%20Brand/web-brand/vite.config.js.timestamp-1664157424389.mjs:36:40)     
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async computeVueRoutes (file:///D:/Project/Web%20Brand/web-brrand/node_modules/.pnpm/[email protected][email protected]/node_moudules/vite-plugin-pages/dist/index.mjs:514:17)
    at async resolveVueRoutes (file:///D:/Project/Web%20Brand/web-brrand/node_modules/.pnpm/[email protected][email protected]/node_moudules/vite-plugin-pages/dist/index.mjs:519:23)
    at async file:///D:/Project/Web%20Brand/web-brand/node_modules/..pnpm/[email protected]/node_modules/rollup/dist/es/shared/rollup.js:221113:98
    at async Queue.work (file:///D:/Project/Web%20Brand/web-brand/noode_modules/.pnpm/[email protected]/node_modules/rollup/dist/es/shared/orollup.js:22820:32)
 ELIFECYCLE  Command failed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.