'vue.js how to create a route poiting to a XML file instade of .vue
I'm trying to figure out how can I create a route pointing to a xml file using vue-router. Actually I need this because I need to set a sitemap.xml at Google search console:
As you can see, Google request a url from my website with .xml extension file.
I've searched everywhere I can't find a away to create a .xml url with vuejs using, for instance, vue-router. Here are my routes using vue-router, of course every route is a .vue file now:
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import NotFound from '../views/NotFound'
import CreateProject from '../views/LeadForm'
import BusinessCustomer from '../views/BusinessCustomer'
Vue.use(VueRouter)
const routes = [{
path: '/',
name: 'Home',
component: Home,
},
{
path: '/projeto/criar',
name: 'CreateProject',
component: CreateProject
},
{
path: '/projeto/criar/:token',
name: 'BusinessCustomer',
component: BusinessCustomer
},
{
path: '*',
name: "404",
component: NotFound
}
]
const router = new VueRouter({
mode: 'history',
base: process.env.BASE_URL,
routes
})
export default router
And here is my sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.gorilafreela.com.br/</loc>
<lastmod>2022-01-25</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://gorilafreela.com.br/projeto/criar</loc>
<lastmod>2022-01-25</lastmod>
<changefreq>monthly</changefreq>
<priority>0.6</priority>
</url>
</urlset>
Anyone have any ideia how can I solve this issue, how can I create a route linking to my sitemap.xml to provide to Google search console. I haven't fund a solution to this issue on the internet. Thanks a lot.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

