Skip to content

Commit

Permalink
Merge pull request #1063 from basedosdados/fix/link-edit-md
Browse files Browse the repository at this point in the history
fix/ajust redirect correct edit md
  • Loading branch information
AldemirLucas authored Dec 11, 2024
2 parents a10e53a + 4b02a31 commit eb59d81
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions next/pages/blog/[slug].js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export async function getStaticProps({ params, locale }) {
return {
props: {
slug,
locale,
...serialize,
...(await serverSideTranslations(locale, ['common', 'blog', 'menu'])),
},
Expand All @@ -69,10 +70,18 @@ export async function getStaticPaths() {
};
}

export default function Post({ slug, mdxSource, headings }) {
export default function Post({ slug, locale, mdxSource, headings }) {
const { t } = useTranslation('blog')
const { frontmatter } = mdxSource;

const repository = () => {
const baseUrl = process.env.NEXT_PUBLIC_BASE_URL_FRONTEND
if (baseUrl === "http://localhost:3000" || baseUrl === "https://development.basedosdados.org") return "development"
if (baseUrl === "https://staging.basedosdados.org") return "staging"
if (baseUrl === "https://basedosdados.org") return "main"
return null
}

return (
<MainPageTemplate
width="100%"
Expand Down Expand Up @@ -188,7 +197,7 @@ export default function Post({ slug, mdxSource, headings }) {
marginTop="24px"
>{t("noticedSomething")} </Text>
<Link
href={`https://github.com/basedosdados/website/edit/main/next/blog/${slug}.md`}
href={`https://github.com/basedosdados/website/edit/${repository()}/next/blog/${locale}/${slug}.md`}
isexternal="true"
fontSize="16px"
fontWeight="400"
Expand Down

0 comments on commit eb59d81

Please sign in to comment.