Redirect /resources to /resources/services
This commit is contained in:
parent
773cba6838
commit
782ca53264
|
@ -64,7 +64,7 @@ const menu: NavLink[] = [
|
|||
},
|
||||
{
|
||||
name: "Resources",
|
||||
route: "/resources/services",
|
||||
route: "/resources",
|
||||
submenu: [
|
||||
{
|
||||
name: "Services",
|
||||
|
@ -84,7 +84,10 @@ const menu: NavLink[] = [
|
|||
|
||||
function NavItem(props: NavItemProps) {
|
||||
const router = useRouter();
|
||||
const externalLink =
|
||||
const isCurrentPage =
|
||||
router.pathname === props.route ||
|
||||
(props.submenu != null && router.pathname.includes(props.route));
|
||||
const isExternalLink =
|
||||
props.route.includes("http://") || props.route.includes("https://");
|
||||
const [mobileDropdownOpen, setMobileDropdownOpen] = useState(false);
|
||||
|
||||
|
@ -97,7 +100,7 @@ function NavItem(props: NavItemProps) {
|
|||
|
||||
return (
|
||||
<>
|
||||
{externalLink ? (
|
||||
{isExternalLink ? (
|
||||
<a
|
||||
href={props.route}
|
||||
target="_blank"
|
||||
|
@ -110,13 +113,7 @@ function NavItem(props: NavItemProps) {
|
|||
<Link href={props.route}>
|
||||
<a
|
||||
title={props.name}
|
||||
className={
|
||||
router.pathname === props.route ||
|
||||
((props.submenu?.length ?? 0) > 0 &&
|
||||
router.pathname.split("/")[1] === props.route.split("/")[1])
|
||||
? styles.currentPage
|
||||
: ""
|
||||
}
|
||||
className={isCurrentPage ? styles.currentPage : ""}
|
||||
onClick={handleClick}
|
||||
>
|
||||
{props.name}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import { GetStaticProps } from "next";
|
||||
|
||||
export const getStaticProps: GetStaticProps<{}> = async () => {
|
||||
return {
|
||||
redirect: {
|
||||
destination: "/resources/services",
|
||||
permanent: false,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
export default function Resources() {
|
||||
return null;
|
||||
}
|
Loading…
Reference in New Issue