Skip to content

Commit

Permalink
Merge pull request #1226 from near/develop
Browse files Browse the repository at this point in the history
2x weekly promotion of develop to main
  • Loading branch information
shelegdmitriy authored Jun 27, 2024
2 parents 828b3c6 + 14803fb commit cd58a72
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const nextConfig = {
permanent: false,
},
{
source: '/auditrequest',
source: '/assessments',
destination: 'https://airtable.com/appr1nBRRGx2PTJVh/shrpa99vKKW3xafso',
permanent: false,
},
Expand Down
14 changes: 8 additions & 6 deletions src/pages/blog/[[...pages]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,19 @@ import { recordHandledError } from '@/utils/analytics';
import type { NextPageWithLayout } from '@/utils/types';

export const getServerSideProps = (async ({ resolvedUrl }) => {
const isProd = ['https://near.org', 'https://dev.near.org'].some((url) => process.env.NEXT_PUBLIC_HOSTNAME === url);
const blog_branch = isProd ? 'main' : 'develop';
const blogParts = resolvedUrl.split('blog/');
let title = 'index.html';
if (blogParts[1] !== title) {
title = `${blogParts[1].substring(0, blogParts[1].indexOf('/'))}/index.html`;
}
const res = await fetch(`https://raw.githubusercontent.com/near/nearorg_marketing/main/public/blog/${title}`).catch(
(e) => {
recordHandledError({ title, message: 'failed to fetch github blog html for requested title' });
throw e;
},
);
const res = await fetch(
`https://raw.githubusercontent.com/near/nearorg_marketing/${blog_branch}/public/blog/${title}`,
).catch((e) => {
recordHandledError({ title, message: 'failed to fetch github blog html for requested title' });
throw e;
});

const __html = await (await res.blob()).text();

Expand Down

0 comments on commit cd58a72

Please sign in to comment.