Next.js Discord

Discord Forum

How to Navigate <Link> to an .html File with Next.js Static Exports?

Answered
Hutton's Vireo posted this in #help-forum
Open in Discord
Hutton's VireoOP
Hi, I'm currently using the Static Exports feature in Next.js. How can I navigate the contents of a <Link> to an .html file?
Answered by B33fb0n3
Even with static generated files, you can directly navigate to /your/path/about.html. So in this case, you add .html at the end. That should work
View full answer

11 Replies

@Hutton's Vireo Hi, I'm currently using the Static Exports feature in Next.js. How can I navigate the contents of a <Link> to an .html file?
you can use the same syntax as you would, when you normally use nextjs as server. So link it with just <Link href={'/your/path/'} />
@B33fb0n3 you can use the same syntax as you would, when you normally use nextjs as server. So link it with just <Link href={'/your/path/'} />
Hutton's VireoOP
I'm actually trying to access the /your/path.html file, and if I access /your/path, it will get an error.
@Hutton's Vireo I'm actually trying to access the /your/path.html file, and if I access /your/path, it will get an error.
Are you using the app router?
Can you share the error?

Normally then the page will be generated from /your/path/page.tsx and like that you can also directly link to it like /your/path
Hutton's VireoOP
Yes, I used the app router
@Hutton's Vireo like this.
how do you start your app? With which command?
@B33fb0n3 how do you start your app? With which command?
Hutton's VireoOP
live server extension using vscode
@Hutton's Vireo live server extension using vscode
Even with static generated files, you can directly navigate to /your/path/about.html. So in this case, you add .html at the end. That should work
Answer
Happy to help
@B33fb0n3
Hutton's VireoOP
I learned that the index.html file can be accessed through the nginx configuration. Thank you for your help!