From 1162dc53e35c014ab7a29daf4d0ebfded94e501c Mon Sep 17 00:00:00 2001 From: liberaldev Date: Fri, 4 Aug 2023 19:10:13 +0900 Subject: [PATCH] =?UTF-8?q?head=20=ED=83=9C=EA=B7=B8=EC=97=90=EC=84=9C=20t?= =?UTF-8?q?itle=20=ED=83=9C=EA=B7=B8=20=EB=82=98=EC=98=A4=EB=8F=84?= =?UTF-8?q?=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 16 +++++----- src/client/components/common/title.tsx | 20 +++++++++++-- src/client/components/pages/index.tsx | 5 +++- src/client/components/pages/latest.tsx | 2 +- views/index.pug | 2 ++ yarn.lock | 41 ++++++++++++++++++++++++++ 6 files changed, 75 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 17f2e85..9d185bb 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@types/pug": "^2.0.4", "@types/react": "^16.9.11", "@types/react-dom": "^16.9.3", + "@types/react-helmet": "^6.1.6", "@types/react-router-dom": "^5.1.2", "@types/reactstrap": "^8.0.6", "@typescript-eslint/eslint-plugin": "^2.6.1", @@ -42,24 +43,17 @@ "babel-core": "^6.26.0", "babel-loader": "^8.0.6", "babel-preset-env": "^1.7.0", - "bootstrap": "^4.3.1", - "bootswatch": "^4.3.1", "cpx": "^1.5.0", "css-loader": "^3.2.0", "eslint": "^6.6.0", "fetch-defaults": "^1.0.0", "file-loader": "^4.2.0", - "jquery": "^3.4.1", "megalodon": "^2.0.0", "moment": "^2.24.0", "node-dev": "^4.0.0", "npm-run-all": "^4.1.5", "page": "^1.11.5", "popper.js": "^1.16.0", - "react": "^16.11.0", - "react-dom": "^16.11.0", - "react-router-dom": "^5.1.2", - "reactstrap": "^8.1.1", "style-loader": "^1.0.0", "ts-loader": "^6.2.1", "typescript": "^3.7.2", @@ -69,6 +63,8 @@ "webpack-dev-server": "^3.9.0" }, "dependencies": { + "bootstrap": "^4.3.1", + "bootswatch": "^4.3.1", "common-tags": "^1.8.0", "dotenv": "^8.2.0", "koa": "^2.11.0", @@ -84,6 +80,12 @@ "node-fetch": "^2.6.0", "oauth-1.0a": "github:rinsuki/oauth-1.0a", "parse-link-header": "^1.0.1", + "react": "^16.11.0", + "react-dom": "^16.11.0", + "react-helmet": "^6.1.0", + "react-router-dom": "^5.1.2", + "reactstrap": "^8.1.1", + "jquery": "^3.4.1", "rndstr": "^1.0.0" } } diff --git a/src/client/components/common/title.tsx b/src/client/components/common/title.tsx index ec46e49..a512508 100644 --- a/src/client/components/common/title.tsx +++ b/src/client/components/common/title.tsx @@ -1,9 +1,25 @@ import * as React from 'react'; +import { Helmet } from 'react-helmet'; +import { Children } from 'react'; + export class Title extends React.Component { - render() + title = (): string => { - return {this.props.children} - Quesdon; + const childrenAsString: string = Children.map(this.props.children, child => + { + return child?.toString(); + }).join('').toString(); + return childrenAsString + ' - Quesdon@Planet'; + }; + + render(): React.ReactNode + { + return ( + + {this.title()} + + ); } } diff --git a/src/client/components/pages/index.tsx b/src/client/components/pages/index.tsx index e471899..9d2dfbb 100644 --- a/src/client/components/pages/index.tsx +++ b/src/client/components/pages/index.tsx @@ -2,17 +2,20 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; import { me } from '../../initial-state'; import { PageLatest } from './latest'; +import {Helmet} from "react-helmet"; export class PageIndex extends React.Component { render() { return
- Quesdon@Planet

Quesdon@Planet

Mastodon에서 사용할 수 있는 askfm스러운 무언가

{me ? 마이페이지 : 로그인}

+ + Quesdon@Planet +
; } } diff --git a/src/client/components/pages/latest.tsx b/src/client/components/pages/latest.tsx index 85a8d25..3245fa2 100644 --- a/src/client/components/pages/latest.tsx +++ b/src/client/components/pages/latest.tsx @@ -31,7 +31,7 @@ export class PageLatest extends React.Component<{}, State> questions } = this.state; return
- 최근 답변 - Quesdon + 최근 답변

최근 올라온 답변들

{ loading ? diff --git a/views/index.pug b/views/index.pug index 8680546..33fcf0d 100644 --- a/views/index.pug +++ b/views/index.pug @@ -12,6 +12,7 @@ html if profile - const title = `${profile.name}님의 ${profile.questionBoxName || '질문함'}` - const description = profile.description || `${josa(title, '이에요', '예요')}` + title #{title} - #{siteName} meta(name="twitter:card", content="summary") meta(property="og:site_name", content=siteName) meta(property="og:title", content=title) @@ -21,6 +22,7 @@ html link(rel="me",href=profile.url) else - const description = "Mastodon에서 사용할 수 있는 askfm스러운 무언가" + title #{siteName} meta(property="og:site_name", content=siteName) meta(property="og:title", content=siteName) meta(name="description", content=description) diff --git a/yarn.lock b/yarn.lock index 96222ad..cfd8cd5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -399,6 +399,13 @@ dependencies: "@types/react" "*" +"@types/react-helmet@^6.1.6": + version "6.1.6" + resolved "https://registry.yarnpkg.com/@types/react-helmet/-/react-helmet-6.1.6.tgz#7d1afd8cbf099616894e8240e9ef70e3c6d7506d" + integrity sha512-ZKcoOdW/Tg+kiUbkFCBtvDw0k3nD4HJ/h/B9yWxN4uDO8OkRksWTO+EL+z/Qu3aHTeTll3Ro0Cc/8UhwBCMG5A== + dependencies: + "@types/react" "*" + "@types/react-router-dom@^5.1.2": version "5.1.2" resolved "https://registry.yarnpkg.com/@types/react-router-dom/-/react-router-dom-5.1.2.tgz#853f229f1f297513c0be84f7c914a08b778cfdf5" @@ -5859,6 +5866,15 @@ prop-types@^15.5.8, prop-types@^15.6.1, prop-types@^15.6.2: object-assign "^4.1.1" react-is "^16.8.1" +prop-types@^15.7.2: + version "15.8.1" + resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.8.1.tgz#67d87bf1a694f48435cf332c24af10214a3140b5" + integrity sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg== + dependencies: + loose-envify "^1.4.0" + object-assign "^4.1.1" + react-is "^16.13.1" + proxy-addr@~2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.5.tgz#34cbd64a2d81f4b1fd21e76f9f06c8a45299ee34" @@ -6138,6 +6154,26 @@ react-dom@^16.11.0: prop-types "^15.6.2" scheduler "^0.17.0" +react-fast-compare@^3.1.1: + version "3.2.2" + resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz#929a97a532304ce9fee4bcae44234f1ce2c21d49" + integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ== + +react-helmet@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-6.1.0.tgz#a750d5165cb13cf213e44747502652e794468726" + integrity sha512-4uMzEY9nlDlgxr61NL3XbKRy1hEkXmKNXhjbAIOVw5vcFrsdYbH2FEwcNyWvWinl103nXgzYNlns9ca+8kFiWw== + dependencies: + object-assign "^4.1.1" + prop-types "^15.7.2" + react-fast-compare "^3.1.1" + react-side-effect "^2.1.0" + +react-is@^16.13.1: + version "16.13.1" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" + integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== + react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.1: version "16.11.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.11.0.tgz#b85dfecd48ad1ce469ff558a882ca8e8313928fa" @@ -6189,6 +6225,11 @@ react-router@5.1.2: tiny-invariant "^1.0.2" tiny-warning "^1.0.0" +react-side-effect@^2.1.0: + version "2.1.2" + resolved "https://registry.yarnpkg.com/react-side-effect/-/react-side-effect-2.1.2.tgz#dc6345b9e8f9906dc2eeb68700b615e0b4fe752a" + integrity sha512-PVjOcvVOyIILrYoyGEpDN3vmYNLdy1CajSFNt4TDsVQC5KpTijDvWVoR+/7Rz2xT978D8/ZtFceXxzsPwZEDvw== + react-transition-group@^2.3.1: version "2.9.0" resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-2.9.0.tgz#df9cdb025796211151a436c69a8f3b97b5b07c8d"