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

fix: fixed the url rendering and OG tag issue #2866

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion components/Head.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function HeadComponent({
rssTitle = 'RSS Feed for AsyncAPI Initiative Blog',
rssLink = '/rss.xml',
}) {
const url = process.env.DEPLOY_PRIME_URL || process.env.DEPLOY_URL || 'http://localhost:3000';
const url = process.env.NEXT_PUBLIC_DEPLOY_PRIME_URL || process.env.NEXT_PUBLIC_DEPLOY_URL || 'http://localhost:3000';
const appContext = useContext(AppContext);
const { path = '' } = appContext || {};

Expand Down
16 changes: 16 additions & 0 deletions components/custom.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react'
import HeadComponent from './Head'
import HomePage from '../pages'
import Footer from '../components/footer/Footer'

const Custom = () => {
return (
<div>
<HeadComponent/>
<HomePage/>
<Footer/>
</div>
)
}

export default Custom
16 changes: 16 additions & 0 deletions lib/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ import {
Translation,
Trans
} from "react-i18next";

import nextI18nextStaticSiteConfig from "../next-i18next-static-site.config";
import HeadComponent from "../components/Head";
<<<<<<< HEAD
import Custom from "../components/custom";
import App from "../pages/_app";
=======
>>>>>>> f1fc8ea672efa3d41621bb124db04e11f310ceda
var defaultConfig = {
allowHydration: true,
languages: ["en"],
Expand All @@ -19,6 +26,7 @@ var defaultConfig = {
cookieName: "lang",
cookieOptions: { expires: 365, path: "/" }
};

var config = {
...defaultConfig,
languages: nextI18nextStaticSiteConfig.i18n.languages,
Expand Down Expand Up @@ -145,21 +153,29 @@ var I18nProvider = (props) => {
i18nextInstance(language, props.i18n.locales);
}
const { i18n: i18n2 } = useTranslation();

useEffect(() => {
i18n2.services.resourceStore.data = props.i18n.locales;
i18n2.changeLanguage(language);
}, [i18n2, language, props.i18n.locales]);

useEffect(() => {
loaded = true;
i18n2.changeLanguage(language);
}, [i18n2, language]);

useEffect(() => {
const hasWindow = typeof window !== "undefined";
if (hasWindow && options.allowHydration) {
setHydration(true);
}
}, [options.allowHydration]);
<<<<<<< HEAD

return hydration ? props.children : null;
=======
return hydration ? props.children : <HeadComponent />;
>>>>>>> f1fc8ea672efa3d41621bb124db04e11f310ceda
};

/**
Expand Down
46 changes: 18 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
"axios": "^1.6.0",
"clsx": "^1.1.1",
"cssnano": "^5.1.12",
"dotenv": "^8.2.0",
"dotenv": "^8.6.0",
"fuse.js": "^6.6.2",
"googleapis": "^100.0.0",
"gray-matter": "^4.0.2",
Expand Down
Loading