Is it possible to add jsx or tsx pages in the site menu? #3869
Replies: 5 comments 1 reply
-
Ok. I turned my page into an .mdx-file. I guess I can insert react code this way. |
Beta Was this translation helpful? Give feedback.
-
Could anyone give me example code, an .mdx page code, that fetch and displays data from an API? I don't understand how this works. I've tried 50+ ways to include posted mdx and rect code that should do the trick but ends up in errors either "Could not parse import/exports with acorn" or "Exhaust error" etc etc. Or am I doing it wrong? Is it not possible to let eg. /pages/dynamicpage.mdx fetch data and display? Thanks! |
Beta Was this translation helpful? Give feedback.
-
Interested also in this. If you find a solution, let me know. I suppose you already tried to put in the |
Beta Was this translation helpful? Give feedback.
-
@MikeAndFriends: Just tried and it works! |
Beta Was this translation helpful? Give feedback.
-
See the import { FaUserGraduate } from "react-icons/fa";
import UserName from "@/components/username";
export default {
"index": {
title: "What's new",
display: "hidden"
},
"labs": "Labs",
"clases": "Classes",
"topics": "Topics",
"references": {
"title": "References",
"href": "/references",
"newWindow": false
},
"resources": {
"title": "Resources",
"href": "/resources",
"newWindow": false
},
"schedules": "Schedules",
"previous-courses": {
"title": "Previous Courses",
"href": "/previous-courses",
"display": "hidden",
"newWindow": false
},
//"nextra-playground": "Learning Nextra",
/*
"challenges": {
"title": "Challenges",
"type": "page",
"display": "hidden"
},*/
"auth": {
"title": "Auth",
"type": "page",
"display": "hidden"
},
"feedback": {
"title": "Feedback",
"type": "menu",
"items": {
"feedback": {
"title": "PL Notes Feedback",
"href": "https://github.com/orgs/ULL-ESIT-PL-2425/discussions/categories/typos-not-found-pages-and-errors-in-pl-notes-at-https-apuntes-pl-vercel-app",
"newWindow": true
},
"Q&A": {
"title": "PL Q&A",
"href": "https://github.com/orgs/ULL-ESIT-PL-2425/discussions/categories/q-a",
"newWindow": true
},
}
},
"github": {
"title": "GitHub",
"type": "menu",
"items": {
"org": {
"title": "ULL-ESIT-PL-2425 ↗",
"href": "https://github.com/ULL-ESIT-PL-2425",
"newWindow": true
},
"classroom": {
"title": "GitHub Classroom ↗",
"href": "https://classroom.github.com/classrooms/176797847-ull-esit-pl-2425",
"newWindow": true
},
"template-org": {
"title": "ULL-ESIT-PL ↗",
"href": "https://github.com/ULL-ESIT-PL",
"newWindow": true
},
"this-site-repo": {
"title": "apuntes-pl source↗",
"href": "https://github.com/ULL-ESIT-PL/apuntes-pl/",
"newWindow": true
},
"teams": {
"title": "Teams ↗",
"href": "https://github.com/orgs/ULL-ESIT-PL-2425/teams",
"newWindow": true
},
"resources": {
"title": "Github Resources",
"href": "/resources#recursos-github",
"newWindow": false
},
"your issues": {
"title": "Your Issues ↗",
"href": "https://github.com/issues/assigned",
"newWindow": true
},
"GitHub Community": {
"title": "GitHub Community: Education ↗",
"href": "https://github.com/orgs/community/discussions/categories/github-education?discussions_q=is%3Aopen+category%3A%22GitHub+Education%22",
"newWindow": true
}
}
},
"deploys": {
"title": "Deploys",
"type": "menu",
"items": {
"vercel deploy": {
"title": "Vercel ↗",
"href": "https://apuntes-pl.vercel.app/",
"newWindow": true
},
"vercel dashboard": {
"title": "Vercel Dashboard ↗",
"href": "https://vercel.com/crguezls-projects/apuntes-pl/deployments",
"newWindow": true
}
}
},
"Tools": {
"title": "Tools",
"type": "menu",
"items": {
"Babel": {
"title": "Babel",
"href": "https://github.com/ULL-ESIT-PL/babel-learning",
"newWindow": true
},
"nearley": {
"title": "Nearley",
"href": "https://nearley.js.org/",
"newWindow": true
},
"moo-ignore": {
"title": "Moo Ignore",
"href": "https://www.npmjs.com/package/moo-ignore",
"newWindow": true
},
"ast-explorer": {
"title": "AST Explorer",
"href": "https://astexplorer.net/",
"newWindow": true
},
"compact-js-ast": {
"title": "Compact JS AST",
"href": "https://www.npmjs.com/package/compact-js-ast",
"newWindow": true
},
"ast-compare": {
"title": "AST Compare",
"href": "https://github.com/ULL-ESIT-PL/ast-compare",
"newWindow": true
},
"espree": {
"title": "Espree",
"href": "https://github.com/eslint/espree",
"newWindow": true
},
"jison": {
"title": "Jison",
"href": "https://gerhobbelt.github.io/jison/docs/",
"newWindow": true
},
"estraverse": {
"title": "Estraverse",
"href": "/topics/introduction-to-pl/esprima#traversing-the-ast",
"newWindow": true
},
"ast-types": {
"title": "ast-types",
"href": "https://github.com/benjamn/ast-types",
"newWindow": true
},
"nextra": {
"title": "Nextra",
"href": "https://nextra.vercel.app/",
"newWindow": true
},
"ChatULL": {
"title": "Chat ULL (TFG Jonay)",
"href": "https://chatull.pages.dev",
"newWindow": true
}
}
},
"pl-includes": {
"title": "____",
"type": "page",
"display": "hidden"
},
"PL": {
"title": "PL",
"type": "menu",
"items": {
"Classes": {
"title": "Classes && Exams",
"href": "/clases",
"newWindow": false
},
"Labs": {
"title": "Labs",
"href": "/labs",
"newWindow": false
},
"Topics": {
"title": "Topics",
"href": "/topics",
"newWindow": false
},
"Schedules": {
"title": "Schedules",
"href": "/schedules",
"newWindow": false
},
"Resources": {
"title": "Resources",
"href": "/resources",
"newWindow": false
},
"References": {
"title": "References",
"href": "/references",
"newWindow": false
},
"Previous Courses": {
"title": "Previous Courses",
"href": "/previous-courses",
"newWindow": false
}
}
},
"ull": {
"title": "ULL",
"type": "menu",
"items": {
"Guía": {
"title": "Guía Docente ↗",
"href": "https://www.ull.es/apps/guias/guias/view_guide/39709/",
"newWindow": true
},
"contact": {
"title": "Teacher ↗",
"href": "https://www.ull.es/apps/guias/guias/view_teacher_niu/1316/crguezl//",
"newWindow": true
},
"campus": {
"title": "Campus virtual ↗",
"href": "https://campusingenieriaytecnologia2425.ull.es/course/view.php?id=2425090148",
"newWindow": true
},
"resources": {
"title": "ULL Resources",
"href": "/resources#recursos-ull",
"newWindow": false
}
}
},
"Grado II": {
"title": "Grado II",
"type": "menu",
"items": {
"Ingeniería Informática": {
"title": "Ingeniería Informática ↗",
"href": "https://www.ull.es/grados/ingenieria-informatica/",
"newWindow": true
},
"Horarios y Exámenes": {
"title": "Horarios y Exámenes ↗",
"href": "https://www.ull.es/grados/ingenieria-informatica/informacion-academica/horarios-y-calendario-examenes/",
"newWindow": true
},
"Normativa": {
"title": "Normativa y Reglamentos ↗",
"href": "https://www.ull.es/grados/ingenieria-informatica/informacion-academica/normativa-y-reglamentos/",
"newWindow": true
},
"Evaluación": {
"title": "Evaluación y Calificación ↗",
"href": "https://www.ull.es/portal/normativa/categorias/evaluacion-y-calificacion/",
"newWindow": true
}
}
},
"Google": {
"title": "Google",
"type": "menu",
"items": {
"PL Meet": {
"title": "PL Meet",
"href": "https://meet.google.com/eha-yfij-zmo",
"newWindow": true
},
"Google Chat": {
"title": "Google Chat",
"href": "https://mail.google.com/chat/u/1/#chat/welcome",
"newWindow": true
},
"Google Spreadsheets": {
"title": "Google Spreadsheets",
"href": "https://docs.google.com/spreadsheets/u/1/?tgif=d",
"newWindow": true
},
"24/25 coordination": {
"title": "24/25 coordination",
"href": "https://docs.google.com/spreadsheets/d/11Y9JnIk5P5Nt5bKkPUTHsdwxlTb9xrkaOuZvJgq8rmc",
"newWindow": true
}
}
},
"Vídeos": {
"title": "Vídeos",
"type": "menu",
"items": {
"Curso 24/25": {
"title": "Curso 24/25",
"href": "https://www.youtube.com/playlist?list=PLuPGCp-dfrUQI0koCk1k-x7C2k5luHz0o",
"newWindow": true
},
"Curso 23/24": {
"title": "Curso 23/24",
"href": "https://www.youtube.com/playlist?list=PLuPGCp-dfrUSHR7MIawBJqAs734iygFmB",
"newWindow": true
},
"Curso 22/23": {
"title": "Curso 22/23",
"href": "https://www.youtube.com/playlist?list=PLuPGCp-dfrUQ1SMSQWaW-PDeoxJpk2uzh",
"newWindow": true
},
"Curso 21/22": {
"title": "Curso 21/22",
"href": "https://youtube.com/playlist?list=PLuPGCp-dfrUQbbnbT_8qHK1WQYurYwBEY",
"newWindow": true
},
"Curso 20/21": {
"title": "Curso 20/21",
"href": "https://www.youtube.com/playlist?list=PLuPGCp-dfrUTzN_o2beArY1QoFUTGH-yd",
"newWindow": true
},
"Curso 19/20": {
"title": "Curso 19/20",
"href": "https://youtube.com/playlist?list=PLuPGCp-dfrUTByhC5b9vInei9OzdYSBs7",
"newWindow": true
}
}
},
"user": {
"title": <UserName size="3em" title="meet"/>, // <FaUserGraduate />,
"type": "page",
"href": "/user",
"newWindow": false,
"display": "hidden"
},
protected: {
"title": "Middleware protected pages",
"display": "hidden"
}
} and here is the code of the component: apuntes-pl git:(main) cat components/username.jsx
import { useSession, /*signIn, signOut*/ } from "next-auth/react"
import { FaUserGraduate } from "react-icons/fa";
//import Styles from "@/components/UserRepos.module.css"
export default function Component() {
const { data: session } = useSession()
if (session) {
return (<img src={session.user.image} alt={session.user.name} width="16" height="16" />)
}
return (<FaUserGraduate />)
} Have a look at https://apuntes-pl.vercel.app/clases/january/2025-01-28-leccion. Is the user icon in the navigation bar. |
Beta Was this translation helpful? Give feedback.
-
I would like to combine static and dynamic pages on my site and display them in the left side Nextra menu (/pages/dynamicpage.jsx). Is that possible? Do I need to add something to any config files or _meta.js? How can I do this?
Beta Was this translation helpful? Give feedback.
All reactions