From 7d52176feaa7a523247e8a0ac7c7a2569b790620 Mon Sep 17 00:00:00 2001 From: Milos Vetesnik Date: Thu, 24 Oct 2024 12:49:33 +0200 Subject: [PATCH] feat: added sitemap & fixed robot txt (#8699) --- excalidraw-app/package.json | 15 ++++++++------ excalidraw-app/vite.config.mts | 21 ++++++++++++++++---- public/robots.txt | 6 +++++- yarn.lock | 36 +++++++++++++++++++++++++++++++--- 4 files changed, 64 insertions(+), 14 deletions(-) diff --git a/excalidraw-app/package.json b/excalidraw-app/package.json index e404df19c..69fc1ec48 100644 --- a/excalidraw-app/package.json +++ b/excalidraw-app/package.json @@ -26,17 +26,17 @@ "node": ">=18.0.0" }, "dependencies": { + "@excalidraw/random-username": "1.0.0", + "@sentry/browser": "6.2.5", + "@sentry/integrations": "6.2.5", "firebase": "8.3.3", + "i18next-browser-languagedetector": "6.1.4", "idb-keyval": "6.0.3", "jotai": "1.13.1", "react": "18.2.0", "react-dom": "18.2.0", - "vite-plugin-html": "3.2.2", - "@excalidraw/random-username": "1.0.0", - "@sentry/browser": "6.2.5", - "@sentry/integrations": "6.2.5", - "i18next-browser-languagedetector": "6.1.4", - "socket.io-client": "4.7.2" + "socket.io-client": "4.7.2", + "vite-plugin-html": "3.2.2" }, "prettier": "@excalidraw/prettier-config", "scripts": { @@ -49,5 +49,8 @@ "start:production": "yarn build && yarn serve", "serve": "npx http-server build -a localhost -p 5001 -o", "build:preview": "yarn build && vite preview --port 5000" + }, + "devDependencies": { + "vite-plugin-sitemap": "0.7.1" } } diff --git a/excalidraw-app/vite.config.mts b/excalidraw-app/vite.config.mts index 0ad397b16..5174e5c75 100644 --- a/excalidraw-app/vite.config.mts +++ b/excalidraw-app/vite.config.mts @@ -5,6 +5,7 @@ import { ViteEjsPlugin } from "vite-plugin-ejs"; import { VitePWA } from "vite-plugin-pwa"; import checker from "vite-plugin-checker"; import { createHtmlPlugin } from "vite-plugin-html"; +import Sitemap from "vite-plugin-sitemap"; import { woff2BrowserPlugin } from "../scripts/woff2/woff2-vite-plugins"; // To load .env.local variables @@ -52,6 +53,13 @@ export default defineConfig({ assetsInlineLimit: 0, }, plugins: [ + Sitemap({ + hostname: "https://excalidraw.com", + outDir: "build", + changefreq: "monthly", + // its static in public folder + generateRobotsTxt: false, + }), woff2BrowserPlugin(), react(), checker({ @@ -75,14 +83,19 @@ export default defineConfig({ }, workbox: { - // don't precache fonts, locales and separate chunks - globIgnores: ["fonts.css", "**/locales/**", "service-worker.js", "**/*.chunk-*.js"], + // don't precache fonts, locales and separate chunks + globIgnores: [ + "fonts.css", + "**/locales/**", + "service-worker.js", + "**/*.chunk-*.js", + ], runtimeCaching: [ { urlPattern: new RegExp(".+.woff2"), - handler: 'CacheFirst', + handler: "CacheFirst", options: { - cacheName: 'fonts', + cacheName: "fonts", expiration: { maxEntries: 1000, maxAgeSeconds: 60 * 60 * 24 * 90, // 90 days diff --git a/public/robots.txt b/public/robots.txt index 1829690cd..f956a6b93 100644 --- a/public/robots.txt +++ b/public/robots.txt @@ -4,6 +4,10 @@ Disallow: User-agent: facebookexternalhit Disallow: -user-agent: * +User-agent: * Allow: /$ +Allow: / +Allow: /sitemap.xml Disallow: / + +Sitemap: https://excalidraw.com/sitemap.xml diff --git a/yarn.lock b/yarn.lock index d593b2a63..9b3180535 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9638,7 +9638,7 @@ string-natural-compare@^3.0.1: resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4" integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw== -"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -9656,6 +9656,15 @@ string-width@^4.1.0, string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" +string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^5.0.0, string-width@^5.0.1, string-width@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/string-width/-/string-width-5.1.2.tgz#14f8daec6d81e7221d2a357e668cab73bdbca794" @@ -9727,7 +9736,14 @@ stringify-object@^3.3.0: is-obj "^1.0.1" is-regexp "^1.0.0" -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@6.0.1, strip-ansi@^3.0.0, strip-ansi@^6.0.0, strip-ansi@^6.0.1, strip-ansi@^7.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + +strip-ansi@6.0.1, strip-ansi@^3.0.0, strip-ansi@^6.0.0, strip-ansi@^6.0.1, strip-ansi@^7.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -10388,6 +10404,11 @@ vite-plugin-pwa@0.17.4: workbox-build "^7.0.0" workbox-window "^7.0.0" +vite-plugin-sitemap@0.7.1: + version "0.7.1" + resolved "https://registry.yarnpkg.com/vite-plugin-sitemap/-/vite-plugin-sitemap-0.7.1.tgz#3b3cf6d2e067ec835f810e5eaaacf05485c819fe" + integrity sha512-4NRTkiWytLuAmcikckrLcLl9iYA20+5v6l8XshcOrzxH1WR8H0O3S6sTQYfjMrE8su/LG6Y0cTodvOdcOIxaLw== + vite-plugin-svgr@4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/vite-plugin-svgr/-/vite-plugin-svgr-4.2.0.tgz#9f3bf5206b0ec510287e56d16f1915e729bb4e6b" @@ -10959,7 +10980,7 @@ workbox-window@7.1.0, workbox-window@^7.0.0: "@types/trusted-types" "^2.0.2" workbox-core "7.1.0" -"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0: +"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== @@ -10977,6 +10998,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"