mirror of
https://github.com/kamranahmedse/developer-roadmap.git
synced 2026-03-12 17:51:53 +08:00
Revert "chore: disable pre-render for roadmaps"
This reverts commit 679e29d12d.
This commit is contained in:
1
.astro/types.d.ts
vendored
1
.astro/types.d.ts
vendored
@@ -1,2 +1 @@
|
||||
/// <reference types="astro/client" />
|
||||
/// <reference path="content.d.ts" />
|
||||
@@ -11,6 +11,9 @@ export const prerender = false;
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
||||
// hack to make it work. TODO: Fix
|
||||
const projectRoot = path.resolve(__dirname, '../..').replace(/dist$/, '');
|
||||
|
||||
type RoadmapJson = {
|
||||
_id: string;
|
||||
title: string;
|
||||
|
||||
@@ -3,9 +3,20 @@ import RoadmapHeader from '../../components/RoadmapHeader.astro';
|
||||
import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import { getOpenGraphImageUrl } from '../../lib/open-graph';
|
||||
import { getProjectsByRoadmapId } from '../../lib/project';
|
||||
import { officialRoadmapDetails } from '../../queries/official-roadmap';
|
||||
import {
|
||||
listOfficialRoadmaps,
|
||||
officialRoadmapDetails,
|
||||
} from '../../queries/official-roadmap';
|
||||
|
||||
export const prerender = false;
|
||||
export const prerender = true;
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const roadmaps = await listOfficialRoadmaps();
|
||||
|
||||
return roadmaps.map((roadmap) => ({
|
||||
params: { roadmapId: roadmap.slug },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Params extends Record<string, string | undefined> {
|
||||
roadmapId: string;
|
||||
@@ -14,9 +25,7 @@ interface Params extends Record<string, string | undefined> {
|
||||
const { roadmapId } = Astro.params as Params;
|
||||
const roadmapData = await officialRoadmapDetails(roadmapId);
|
||||
if (!roadmapData) {
|
||||
Astro.response.status = 404;
|
||||
Astro.response.statusText = 'Not found';
|
||||
return Astro.rewrite('/404');
|
||||
return Astro.redirect('/404', 404);
|
||||
}
|
||||
|
||||
// update og for projects
|
||||
|
||||
@@ -16,10 +16,21 @@ import { RoadmapTitleQuestion } from '../../components/RoadmapTitleQuestion';
|
||||
import ResourceProgressStats from '../../components/ResourceProgressStats.astro';
|
||||
import { getProjectsByRoadmapId } from '../../lib/project';
|
||||
import { CheckSubscriptionVerification } from '../../components/Billing/CheckSubscriptionVerification';
|
||||
import { officialRoadmapDetails } from '../../queries/official-roadmap';
|
||||
import {
|
||||
listOfficialRoadmaps,
|
||||
officialRoadmapDetails,
|
||||
} from '../../queries/official-roadmap';
|
||||
import { DateTime } from 'luxon';
|
||||
|
||||
export const prerender = false;
|
||||
export const prerender = true;
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const officialRoadmaps = await listOfficialRoadmaps();
|
||||
|
||||
return officialRoadmaps.map((roadmap) => ({
|
||||
params: { roadmapId: roadmap.slug },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Params extends Record<string, string | undefined> {
|
||||
roadmapId: string;
|
||||
@@ -28,8 +39,6 @@ interface Params extends Record<string, string | undefined> {
|
||||
const { roadmapId } = Astro.params as Params;
|
||||
const roadmapData = await officialRoadmapDetails(roadmapId);
|
||||
if (!roadmapData) {
|
||||
Astro.response.status = 404;
|
||||
Astro.response.statusText = 'Not found';
|
||||
return Astro.rewrite('/404');
|
||||
}
|
||||
|
||||
|
||||
@@ -6,9 +6,20 @@ import BaseLayout from '../../layouts/BaseLayout.astro';
|
||||
import { getProjectsByRoadmapId } from '../../lib/project';
|
||||
import { getOpenGraphImageUrl } from '../../lib/open-graph';
|
||||
import { projectApi } from '../../api/project';
|
||||
import { officialRoadmapDetails } from '../../queries/official-roadmap';
|
||||
import {
|
||||
listOfficialRoadmaps,
|
||||
officialRoadmapDetails,
|
||||
} from '../../queries/official-roadmap';
|
||||
|
||||
export const prerender = false;
|
||||
export const prerender = true;
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const roadmapIds = await listOfficialRoadmaps();
|
||||
|
||||
return roadmapIds.map((roadmap) => ({
|
||||
params: { roadmapId: roadmap.slug },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Params extends Record<string, string | undefined> {
|
||||
roadmapId: string;
|
||||
@@ -17,8 +28,6 @@ interface Params extends Record<string, string | undefined> {
|
||||
const { roadmapId } = Astro.params as Params;
|
||||
const roadmapData = await officialRoadmapDetails(roadmapId);
|
||||
if (!roadmapData) {
|
||||
Astro.response.status = 404;
|
||||
Astro.response.statusText = 'Not found';
|
||||
return Astro.rewrite('/404');
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,20 @@
|
||||
import { EditorRoadmap } from '../../components/EditorRoadmap/EditorRoadmap';
|
||||
import SkeletonLayout from '../../layouts/SkeletonLayout.astro';
|
||||
import { getOpenGraphImageUrl } from '../../lib/open-graph';
|
||||
import { officialRoadmapDetails } from '../../queries/official-roadmap';
|
||||
import {
|
||||
listOfficialRoadmaps,
|
||||
officialRoadmapDetails,
|
||||
} from '../../queries/official-roadmap';
|
||||
|
||||
export const prerender = false;
|
||||
export const prerender = true;
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const roadmapIds = await listOfficialRoadmaps();
|
||||
|
||||
return roadmapIds.map((roadmap) => ({
|
||||
params: { roadmapId: roadmap.slug },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Params extends Record<string, string | undefined> {
|
||||
roadmapId: string;
|
||||
@@ -13,8 +24,6 @@ interface Params extends Record<string, string | undefined> {
|
||||
const { roadmapId } = Astro.params as Params;
|
||||
const roadmapData = await officialRoadmapDetails(roadmapId);
|
||||
if (!roadmapData) {
|
||||
Astro.response.status = 404;
|
||||
Astro.response.statusText = 'Not found';
|
||||
return Astro.rewrite('/404');
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,17 @@ import { ProjectStepper } from '../../../components/Projects/StatusStepper/Proje
|
||||
import { ProjectTrackingActions } from '../../../components/Projects/StatusStepper/ProjectTrackingActions';
|
||||
import { ProjectTabs } from '../../../components/Projects/ProjectTabs';
|
||||
|
||||
export const prerender = false;
|
||||
export const prerender = true;
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const projects = await getAllProjects();
|
||||
|
||||
return projects
|
||||
.map((project) => project.id)
|
||||
.map((projectId) => ({
|
||||
params: { projectId },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Params extends Record<string, string | undefined> {
|
||||
projectId: string;
|
||||
@@ -20,12 +30,6 @@ interface Params extends Record<string, string | undefined> {
|
||||
const { projectId } = Astro.params as Params;
|
||||
|
||||
const project = await getProjectById(projectId);
|
||||
if (!project) {
|
||||
Astro.response.status = 404;
|
||||
Astro.response.statusText = 'Not found';
|
||||
return Astro.rewrite('/404');
|
||||
}
|
||||
|
||||
const projectData = project.frontmatter as ProjectFrontmatter;
|
||||
|
||||
let jsonLdSchema: any[] = [];
|
||||
|
||||
@@ -9,7 +9,18 @@ import { ProjectTabs } from '../../../components/Projects/ProjectTabs';
|
||||
import { ListProjectSolutions } from '../../../components/Projects/ListProjectSolutions';
|
||||
import { ProjectSolutionModal } from '../../../components/Projects/ProjectSolutionModal';
|
||||
|
||||
export const prerender = false;
|
||||
export const prerender = true;
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const projects = await getAllProjects();
|
||||
|
||||
return projects
|
||||
.filter((project) => !(project?.frontmatter?.hasNoSubmission || false))
|
||||
.map((project) => project.id)
|
||||
.map((projectId) => ({
|
||||
params: { projectId },
|
||||
}));
|
||||
}
|
||||
|
||||
interface Params extends Record<string, string | undefined> {
|
||||
projectId: string;
|
||||
@@ -18,12 +29,6 @@ interface Params extends Record<string, string | undefined> {
|
||||
const { projectId } = Astro.params as Params;
|
||||
|
||||
const project = await getProjectById(projectId);
|
||||
if (!project) {
|
||||
Astro.response.status = 404;
|
||||
Astro.response.statusText = 'Not found';
|
||||
return Astro.rewrite('/404');
|
||||
}
|
||||
|
||||
const projectData = project.frontmatter as ProjectFrontmatter;
|
||||
|
||||
let jsonLdSchema: any[] = [];
|
||||
|
||||
@@ -6,8 +6,6 @@ import { ProjectsPage } from '../../components/Projects/ProjectsPage';
|
||||
import { projectApi } from '../../api/project';
|
||||
import { listOfficialRoadmaps } from '../../queries/official-roadmap';
|
||||
|
||||
export const prerender = false;
|
||||
|
||||
const roadmapProjects = await getRoadmapsProjects();
|
||||
const allRoadmapIds = Object.keys(roadmapProjects);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user