1

What is the way to add a .txt file to a Vue single-page application, so it's visible online?

For example, if I want sitemap.txt to appear on myvuewebsite.com at myvuewebsite.com/sitemap.txt ?

Mark Gavagan
  • 878
  • 12
  • 45
  • The text-file is static content, it can also be served by your web-server (Nginx, Apache HTTPD, Node Express, etc.). – hc_dev Feb 06 '23 at 18:47

2 Answers2

1

What I think you can do is to put the sitemap.txt file in your public folder and in your router --> index.js

{ path: "/sitemap.txt"}
0

After you've run npm run build, add the sitemap.txt file to the top-level of your "dist" folder, which is where your build files are.

Note: You need to add the .txt file every time you rebuild the "dist" folder, so this isn't a great solution.

Mark Gavagan
  • 878
  • 12
  • 45