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