Next.js Discord

Discord Forum

Hash Issue

Answered
Blanc de Hotot posted this in #help-forum
Open in Discord
Blanc de HototOP
First hope everybody doing well
I have an issue. I'm trying to make a request based on params.title which is the title of a post i'm trying to get, as you can see bellow.

async function page({ params }) {
  const { existingArtwork } = await getArtworkData(params);

Everything works well. But if my title as an example like :

http://localhost:3000/topics/fan-art/link-and-zelda-concept-#1-924e10e7 


I get an error and that is basically because the title that was sent is :

http://localhost:3000/topics/fan-art/link-and-zelda-concept-


in other words nextjs thinks anything after # is a hash (which is true lol)

i believe i explained the problem well if anyone has a solution like on how to send the whole title, please let me know 🙂
Answered by not-milo.tsx
Hashes are considered special characters in URLs, I suggest removing it from the title otherwise you won't be able to get the whole title from your page params
View full answer

7 Replies

Hashes are considered special characters in URLs, I suggest removing it from the title otherwise you won't be able to get the whole title from your page params
Answer
Hashes are not sent to the server, you can only access them in the browser
Blanc de HototOP
Understood so the only solution is to prevent user from writing a title that includes (#)
Thanks to both of you
If you're using a cms usually that functionality is made available to you already
Blanc de HototOP
All good, thanks again for your time everybody :1000: