Reputation: 1171
I am trying to Link from a nextJS page to a folder containing static build html page, placed in the root.
Is it possible to use Link
or async redirect()
? Or is there any other appropriate way ?
Like <Link href='/anotherStaticBuild'> Click here </Link>
Folder structure
- public
- pages
- anotherStaticBuild(not-next-app)
- build
- index.html
- next.config.js
Upvotes: 1
Views: 411
Reputation: 1221
It is possible to redirect but not directly to the static page you would have to export the page as a string and load it in a component called within a page inside the pages folder and then redirect to that page.
(Note :- but u still can find a way around by importing the static page into a component that is called from a page and adding it to the DOM via the dangerouslySetInnerHTML attribute but cannot redirect directly to it.)
You can check the example given below :-
import DOMPurify from "dompurify";
const htmlContent = <h1>John Doe</h1>
;
const myPage = DOMPurify.sanitize(htmlContent);
const App = () => <div dangerouslySetInnerHTML={{ __html: myPage }} />
Upvotes: 1