From b19190ea9e5f4a1efc34a92a603702a54d097ecb Mon Sep 17 00:00:00 2001 From: Gilpop8663 Date: Wed, 13 Sep 2023 13:38:04 +0900 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20(#594)=20=EB=B9=8C=EB=93=9C?= =?UTF-8?q?=EB=90=98=EA=B8=B0=20=EC=A0=84=20=EC=82=AC=EC=9D=B4=ED=8A=B8?= =?UTF-8?q?=EB=A7=B5=EC=9D=84=20=EC=83=9D=EC=84=B1=20=ED=9B=84=20=EB=B9=8C?= =?UTF-8?q?=EB=93=9C=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/package.json | 1 + frontend/public/seo/robots.txt | 13 ++++++++++ frontend/public/seo/sitemap.xml | 21 +++++++++++++++++ frontend/src/utils/generateSiteMap.js | 34 +++++++++++++++++++++++++++ frontend/webpack.common.js | 5 +++- 5 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 frontend/public/seo/robots.txt create mode 100644 frontend/public/seo/sitemap.xml create mode 100644 frontend/src/utils/generateSiteMap.js diff --git a/frontend/package.json b/frontend/package.json index 6f62a83e7..1e6cbac15 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -8,6 +8,7 @@ "license": "ISC", "scripts": { "dev": "webpack-dev-server --config webpack.dev.js --open --hot", + "prebuild": "cd src/utils && node generateSiteMap.js", "build": "webpack --config webpack.prod.js", "start": "webpack --config webpack.dev.js", "lint": "eslint --cache .", diff --git a/frontend/public/seo/robots.txt b/frontend/public/seo/robots.txt new file mode 100644 index 000000000..ea3074cb8 --- /dev/null +++ b/frontend/public/seo/robots.txt @@ -0,0 +1,13 @@ +# * +User-agent: * +Disallow: /404 + +# * +User-agent: * +Allow: / + +# Host +Host: https://votogether.com/ + +# Sitemaps +Sitemap: https://votogether.com/sitemap.xml \ No newline at end of file diff --git a/frontend/public/seo/sitemap.xml b/frontend/public/seo/sitemap.xml new file mode 100644 index 000000000..33657e5c2 --- /dev/null +++ b/frontend/public/seo/sitemap.xml @@ -0,0 +1,21 @@ + + + + https://votogether.com/ + 2023-09-13T04:22:25.347Z + + + + https://votogether.com/login + 2023-09-13T04:22:25.347Z + + + + https://votogether.com/ranking + 2023-09-13T04:22:25.347Z + + diff --git a/frontend/src/utils/generateSiteMap.js b/frontend/src/utils/generateSiteMap.js new file mode 100644 index 000000000..8a644b132 --- /dev/null +++ b/frontend/src/utils/generateSiteMap.js @@ -0,0 +1,34 @@ +const fs = require('fs'); + +const prettier = require('prettier'); + +const SitemapGeneratedDate = new Date().toISOString(); +const DOMAIN = 'https://votogether.com'; + +const formatting = target => prettier.format(target, { parser: 'html' }); + +const pages = ['/', '/login', '/ranking'].map(page => DOMAIN + page); + +const pageSitemap = pages + .map( + page => ` + + ${page} + ${SitemapGeneratedDate} + + ` + ) + .join(''); + +const generateSiteMap = ` + + + ${pageSitemap} + `; + +const formattedSitemap = formatting(generateSiteMap); + +fs.writeFileSync('../../public/seo/sitemap.xml', formattedSitemap, 'utf8'); diff --git a/frontend/webpack.common.js b/frontend/webpack.common.js index 7a366dacd..8c02bd7d1 100644 --- a/frontend/webpack.common.js +++ b/frontend/webpack.common.js @@ -74,7 +74,10 @@ module.exports = { new CleanWebpackPlugin(), new DotenvWebpack(), new CopyPlugin({ - patterns: [{ from: 'public/icons', to: 'icons' }], + patterns: [ + { from: 'public/icons', to: 'icons' }, + { from: 'public/seo', to: './' }, + ], }), new ForkTsCheckerWebpackPlugin(), ], From bfa58fea8ec2c2283875d7e33523f9cb7daa4bdc Mon Sep 17 00:00:00 2001 From: Gilpop8663 Date: Wed, 13 Sep 2023 13:39:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?chore:=20(#594)=20robots.txt=EC=9D=98=20?= =?UTF-8?q?=EB=A7=88=EC=A7=80=EB=A7=89=20=EA=B0=9C=ED=96=89=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/public/seo/robots.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/public/seo/robots.txt b/frontend/public/seo/robots.txt index ea3074cb8..17b274086 100644 --- a/frontend/public/seo/robots.txt +++ b/frontend/public/seo/robots.txt @@ -10,4 +10,4 @@ Allow: / Host: https://votogether.com/ # Sitemaps -Sitemap: https://votogether.com/sitemap.xml \ No newline at end of file +Sitemap: https://votogether.com/sitemap.xml From 8f7dbcc79435fa1c2937142ae735794c65ab277b Mon Sep 17 00:00:00 2001 From: Gilpop8663 Date: Wed, 13 Sep 2023 14:05:12 +0900 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20(#594)=20=ED=95=9C=EA=B8=80=20?= =?UTF-8?q?=EB=B3=B4=ED=88=AC=EA=B2=8C=EB=8D=94=EB=8F=84=20=EA=B2=80?= =?UTF-8?q?=EC=83=89=EB=90=98=EB=8F=84=EB=A1=9D=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/public/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/public/index.html b/frontend/public/index.html index 868c6195e..c46819b8b 100644 --- a/frontend/public/index.html +++ b/frontend/public/index.html @@ -44,7 +44,7 @@ - VoTogether + 보투게더 - VoTogether