From eb77a6d8c5d04dae7b5bea0dcc5844e54d3fdbc4 Mon Sep 17 00:00:00 2001 From: "Vitor A. Batista" Date: Fri, 29 Mar 2024 12:33:30 -0300 Subject: [PATCH] fix bug direct access --- src/App.tsx | 2 +- src/pages/details-page.tsx | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 52afa8d..0c51fd9 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,4 +1,4 @@ -import { BrowserRouter, Routes, Route } from 'react-router-dom'; +import { HashRouter, BrowserRouter, Routes, Route } from 'react-router-dom'; import HomePage from './pages/home-page'; import AddBlog from './pages/add-blog'; diff --git a/src/pages/details-page.tsx b/src/pages/details-page.tsx index d9bdd92..31377f5 100644 --- a/src/pages/details-page.tsx +++ b/src/pages/details-page.tsx @@ -35,13 +35,6 @@ export default function DetailsPage() { return ""; } } - - const meta = { - title: post.title, - description: 'Blog Viva Viajando ' + getFirstParagraph(post.description), - canonical: window.location.href, - }; - useEffect(() => { const getPostById = async () => { @@ -69,6 +62,11 @@ export default function DetailsPage() { }, []) if (!loading) { + const meta = { + title: post.title, + description: 'Blog Viva Viajando ' + getFirstParagraph(post.description), + canonical: window.location.href, + }; ReactGA.send({ hitType: "pageview", page: postId, title: post.title }); return (