TrademarkTrademarkTrademarkTrademark
Products
Resources
April 22, 2025

Enable or disable pages for your portfolio

Lorant
Enable or disable pages for your portfolio
Magic Portfolio's RouteGuard component takes care of conditionally rendering pages based on the routes object in the resources/config.js file.
src/app/resources/config.js
const routes = {
  '/':        true,
  '/about':   true,
  '/work':    true,
  '/blog':    true,
  '/gallery': false,
};
The code above will ensure that the /gallery page is not accessible and is not displayed in the navigation. When creating a new page, it needs to be added to the routes object in the resources/config.js file.
src/app/resources/config.js
const routes = {
  '/':        true,
  '/about':   true,
  '/work':    true,
  '/blog':    true,
  '/gallery': false,
  '/music': true,
};
The code above will ensure that the /music page is accessible. Users will be able to navigate to it after adding it to the navigation menu in the components/Header.tsx file.
On this page

Build the future.

Start now