Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SEO 최적화 기본 작업 #385

Merged
merged 23 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
894e53e
feat: search console 추가
im-na0 Jul 11, 2024
c2a5d28
feat: og image 추가
im-na0 Jul 11, 2024
608009f
fix: description 태그 제거
im-na0 Jul 11, 2024
168207b
feat: og, meta 태그 수정
im-na0 Jul 11, 2024
88d40cf
chore: 주석 추가
im-na0 Jul 12, 2024
0722f60
refactor: 라우터 계층 구조 올바르게 수정
im-na0 Jul 12, 2024
10c2087
feat: Outlet 컴포넌트 추가
im-na0 Jul 12, 2024
4efce86
feat: Helmet Tag 컴포넌트에 스키마 추가
im-na0 Jul 12, 2024
2fde509
feat: Home 페이지 json-ld 추가
im-na0 Jul 12, 2024
3713c7b
feat: 판매 페이지 json-ld 추가
im-na0 Jul 12, 2024
b5ff14d
feat: 회원가입,로그인 페이지 json-ld 추가
im-na0 Jul 12, 2024
9b43ebb
feat: 검색,검색필터 페이지 json-ld 추가
im-na0 Jul 12, 2024
0387574
feat: 판매내역 페이지 json-ld 추가
im-na0 Jul 12, 2024
321e908
feat: 상품 페이지 json-ld 추가
im-na0 Jul 12, 2024
2e044f6
feat: 설정 페이지 json-ld 추가
im-na0 Jul 12, 2024
321c3bb
feat: 구매내역 페이지 json-ld 추가
im-na0 Jul 12, 2024
f0de59e
feat: 비밀번호 리셋 페이지 json-ld 추가
im-na0 Jul 12, 2024
a2ad154
feat: 마이페이지 json-ld 추가
im-na0 Jul 12, 2024
2279d5b
refactor: 메인 상세 페이지 리팩터링
im-na0 Jul 12, 2024
26d5cf1
refactor: 검색 무한 쿼리 Hooks 분리
im-na0 Jul 12, 2024
06245a1
feat: 야놀자 인증 페이지 json-ld 추가
im-na0 Jul 12, 2024
341ec99
feat: 알림 페이지 json-ld 추가
im-na0 Jul 12, 2024
6e47f60
refactor: carousel height props 제거
im-na0 Jul 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
href="https://cdn.jsdelivr.net/gh/orioncactus/[email protected]/dist/web/variable/pretendardvariable-dynamic-subset.min.css"
/>
<title>퍼센트 호텔</title>
<meta
name="google-site-verification"
content="1iByDUnejFS8cGa288SqOArtDYqEEAiamaOkOZioIx8"
/>
</head>
<script>
(function (m, a, z, e) {
Expand Down
Binary file added public/og-img.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 68 additions & 32 deletions src/components/Helmet/Helmet.tsx
Original file line number Diff line number Diff line change
@@ -1,34 +1,70 @@
import { memo } from "react";
import { Helmet } from "react-helmet-async";

import { PATH } from "@/constants/path";

export const HelmetTag = ({ text }: { text: string }) => {
return (
<Helmet>
<title>{text} | 퍼센트호텔</title>
<meta name="description" content="양도 거래? 취소 보다 빠른 거래!"></meta>

<meta itemProp="name" content="퍼센트 호텔" />
<meta itemProp="description" content="양도 거래? 취소 보다 빠른 거래!" />
<meta itemProp="image" content="/icon-192.png" />

<meta property="og:url" content={PATH.ROOT} />
<meta property="og:type" content="website" />
<meta property="og:title" content={text} />
<meta property="og:site_name" content="퍼센트 호텔" />
<meta property="og:image" content="/icon-192.png" />
<meta
property="og:description"
content="양도 거래? 취소 보다 빠른 거래!"
/>

<meta property="twitter:card" content="/icon-192.png" />
<meta name="twitter:title" content={text} />
<meta
name="twitter:description"
content="양도 거래? 취소 보다 빠른 거래!"
/>
<meta name="twitter:image" content="/src/assets/logos/main_logo.svg" />
</Helmet>
);
};
export const HelmetTag = memo(
({
title,
schemaType = "TravelAgency",
schemaData = {},
}: {
title?: string;
description?: string;
schemaType?: string;
schemaData?: Record<string, any>;
}) => {
console.log(schemaData);

const orig = location.origin;
const url = location.href;
const defaultDescription =
"못 가게된 숙박권 더 이상 돈 날리지 말고, 비싼 호캉스도 믿고 거래하자! 특가보다 저렴한 호캉스 예약.";
const fullTitle = `퍼센트호텔${title ? ` | ${title}` : ""}`;

const baseSchema = {
"@context": "https://schema.org",
"@type": schemaType,
name: `${fullTitle}`,
url: orig,
logo: `${orig}/assets/logos/main_logo.svg`,
description: defaultDescription,
address: {
"@type": "PostalAddress",
addressCountry: "KR",
},
potentialAction: {
"@type": "SearchAction",
target: {
"@type": "EntryPoint",
urlTemplate: `${orig}/search?q={search_term_string}`,
},
"query-input": "required name=search_term_string",
},
};

const fullSchema = { ...baseSchema, ...schemaData };

return (
<Helmet>
<title>{fullTitle}</title>
<meta name="description" content={defaultDescription} />

<meta property="og:url" content={url} />
<meta property="og:type" content="website" />
<meta property="og:title" content={fullTitle} />
<meta property="og:site_name" content="퍼센트 호텔" />
<meta property="og:image" content={`${orig}/og-img.png`} />
<meta property="og:description" content={defaultDescription} />

<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content={fullTitle} />
<meta name="twitter:description" content={defaultDescription} />
<meta
name="twitter:image"
content={`${orig}/assets/logos/main_logo.svg`}
/>

<script type="application/ld+json">{JSON.stringify(fullSchema)}</script>
</Helmet>
);
},
);
8 changes: 1 addition & 7 deletions src/components/carousel/Carousel.style.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import { PiCaretLeftBold, PiCaretRightBold } from "react-icons/pi";
import styled, { css } from "styled-components";

export const CarouselContainer = styled.div<{
$height: number;
}>`
export const CarouselContainer = styled.div`
position: relative;

min-height: ${(props) => `${props.$height}px`};
height: ${(props) => `${props.$height}px`};

overflow: hidden;
cursor: grab;

touch-action: pan-y;
`;
Expand Down
8 changes: 4 additions & 4 deletions src/components/carousel/Carousel.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useCarousel } from "@/hooks/common/useCarousel";
import { useCarouselSize } from "@/hooks/common/useCarouselSize";

import * as S from "./Carousel.style.ts";
import ProgressiveImg from "../progressiveImg/ProgressiveImg.tsx";

import { useCarousel } from "@/hooks/common/useCarousel";
import { useCarouselSize } from "@/hooks/common/useCarouselSize";

interface CarouselProps {
images: string[];
height?: number;
Expand Down Expand Up @@ -41,7 +41,7 @@ const Carousel = ({
});
console.log("currentIndex", currentIndex);
return (
<S.CarouselContainer $height={height}>
<S.CarouselContainer>
<S.SliderWrapper>
<S.SliderContainer
ref={sliderRef}
Expand Down
22 changes: 22 additions & 0 deletions src/components/layout/Outlet.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Outlet as RouterOutlet } from "react-router-dom";

import { HelmetTag } from "@/components/Helmet/Helmet";

const Outlet = ({ title }: { title?: string }) => {
const schemaData = {
"@type": "WebPage",
mainEntityOfPage: {
"@type": "WebPage",
"@id": `${location.origin}${location.pathname}}`,
},
};

return (
<>
<HelmetTag title={title} schemaData={schemaData} />
<RouterOutlet />
</>
);
};

export default Outlet;
45 changes: 45 additions & 0 deletions src/hooks/api/useSearchQuery.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { useSuspenseInfiniteQuery } from "@tanstack/react-query";

import type { ISearchFilterInfo } from "@/types/searchFilterInfo";

import { fetchSearchList } from "@/apis/fetchSeachList";

export const useInfiniteSearchQuery = (searchInfo: ISearchFilterInfo) => {
const pageSize = 10;

return useSuspenseInfiniteQuery({
queryKey: [
"searchItems",
searchInfo.location,
searchInfo.checkIn,
searchInfo.checkOut,
searchInfo.quantityPeople,
searchInfo.sorted,
searchInfo.brunch,
searchInfo.pool,
searchInfo.oceanView,
],
queryFn: ({ pageParam = 0 }) =>
fetchSearchList(
searchInfo.location,
searchInfo.checkIn,
searchInfo.checkOut,
searchInfo.quantityPeople,
searchInfo.sorted,
searchInfo.brunch,
searchInfo.pool,
searchInfo.oceanView,
pageParam,
pageSize,
),
refetchOnMount: false,
refetchOnWindowFocus: false,
initialPageParam: 0,
getNextPageParam: (lastPage) => {
const lastData = lastPage?.content;
return lastData && lastData.length === pageSize
? lastPage?.number + 1
: undefined;
},
});
};
20 changes: 19 additions & 1 deletion src/pages/alarmPage/AlarmPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { fetchUserInfo } from "@/apis/fetchUserInfo";
import NoResult from "@/components/noResult/NoResult";
import { PATH } from "@/constants/path";
import { isMobileSafari } from "@/utils/isMobileSafari";
import { HelmetTag } from "@/components/Helmet/Helmet";

const AlarmPage = () => {
const AlarView = () => {
const mobileSafari = isMobileSafari();

const { data: userData } = useSuspenseQuery({
Expand Down Expand Up @@ -66,4 +67,21 @@ const AlarmPage = () => {
}
};

const AlarmPage = () => {
const schemaData = {
"@type": "WebPage",
mainEntityOfPage: {
"@type": "WebPage",
"@id": `${location.origin}${location.pathname}}`,
},
};

return (
<>
<HelmetTag title="알림" schemaData={schemaData} />
<AlarView />
</>
);
};

export default AlarmPage;
8 changes: 4 additions & 4 deletions src/pages/connectYanoljaPage/IntroPage/IntroPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import XIcon from "@/assets/icons/ic_x.png";
import PercentHotelLogo from "@/assets/logos/Percent-hotel_logo_b.png";
import YanoljaLogo from "@/assets/logos/Yanolja_CI.png";
import { PATH } from "@/constants/path";
import { useNavigate } from "react-router-dom";

import * as S from "./IntroPage.style.ts";

import XIcon from "@/assets/icons/ic_x.png";
import PercentHotelLogo from "@/assets/logos/Percent-hotel_logo_b.png";
import YanoljaLogo from "@/assets/logos/Yanolja_CI.png";
import ProgressiveImg from "@/components/progressiveImg/ProgressiveImg.tsx";
import { PATH } from "@/constants/path";

const IntroPage = () => {
const navigate = useNavigate();
Expand Down
4 changes: 2 additions & 2 deletions src/pages/connectYanoljaPage/successPage/SuccessPage.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import PercentHotelLogo from "@/assets/logos/Percent-hotel_logo_b.png";
import { PATH } from "@/constants/path";
import { useEffect } from "react";
import { useLocation, useNavigate } from "react-router-dom";

import * as S from "./SuccessPage.style.ts";

import PercentHotelLogo from "@/assets/logos/Percent-hotel_logo_b.png";
import Success from "@/components/lottie/success/Success";
import { PATH } from "@/constants/path";

const SuccessPage = () => {
const navigate = useNavigate();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { FormProvider, useForm } from "react-hook-form";

import * as S from "./VerificationPage.style";

import YanoljaLogo from "@/assets/logos/Yanolja_CI.png";
import SubmitButton from "@/pages/connectYanoljaPage/verificationPage/components/submitButton/SubmitButton";
import TermsAgreementSection from "@/pages/connectYanoljaPage/verificationPage/components/termsAgreementSection/TermsAgreementSection";
import VerificationSection from "@/pages/connectYanoljaPage/verificationPage/components/verificationSection/VerificationSection";
import { FormProvider, useForm } from "react-hook-form";

import * as S from "./VerificationPage.style";

const VerificationPage = () => {
const methods = useForm({
Expand Down
Loading
Loading