fix: improve project data handling and sitemap generation
Refactor project data parsing to ensure type safety by casting the project data as a string. Enhance the sitemap generation by fetching data from a dynamic API route, allowing for more accurate and up-to-date sitemap entries. Remove unused project markdown files to clean up the project structure. These changes improve code reliability and maintainability.
This commit is contained in:
@@ -14,6 +14,10 @@ interface Project {
|
||||
meta_description: string;
|
||||
}
|
||||
|
||||
interface ProjectsData {
|
||||
posts: Project[];
|
||||
}
|
||||
|
||||
export default function Projects() {
|
||||
const [projects, setProjects] = useState<Project[]>([]);
|
||||
const [isVisible, setIsVisible] = useState(false);
|
||||
@@ -25,7 +29,7 @@ export default function Projects() {
|
||||
if (!response.ok) {
|
||||
throw new Error("Failed to fetch projects from Ghost");
|
||||
}
|
||||
const projectsData = await response.json();
|
||||
const projectsData = (await response.json()) as ProjectsData;
|
||||
setProjects(projectsData.posts);
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -52,7 +56,7 @@ export default function Projects() {
|
||||
<Link
|
||||
key={project.id}
|
||||
href={{
|
||||
pathname: `/Projects/${project.slug}`,
|
||||
pathname: `/projects/${project.slug}`,
|
||||
query: { project: JSON.stringify(project) },
|
||||
}}
|
||||
className="cursor-pointer"
|
||||
|
||||
Reference in New Issue
Block a user