Dynamic Pages with slugs from API Call

Hey everybody,

I have a problem with setting up dynamic pages. So I am doing this website with an article overview. These articles are fetched from an Wordpress API. This is working. Also fetching a single article. So I got a list of articles in my overview. Clicking on this article brings me to my dynamic page and this is working fine. BUT when i copy the URL of the article and want to open it somewhere else it just shows me a 404 error.

So I did this tutorial of @Joyce and also tried it with the tutorial page.

But I don’t know what I am missing here. I deactivated the “fetch automaticly” option on the collection. And fetch the data on page load.

My API Call and my path

So what do I need to do, that I can copy my url with my slug and use it somewhere else.

I hope it was all understandable and thank you in advance.

Greetings Chris

Hey Chris, welcome to the community :waving_hand:

So, just to make sure I understand you, your dynamic page isn’t fetching the article data based on the slug when accessed directly. It only works if you navigate from the article list, right?

I believe you are skipping a step regarding fetching your collection.

Try this:

  • Add a “Fetch Collection” workflow on your dynamic page, triggered On Page Load, using the slug from the URL.
  • Make sure your bindings use the slug to fetch the right article.

Let me know if this helped

Hey @Agustin_Carozo

thanks for your reply. I do that. But my guess is, that the URL is seen as URL and not an URL with a slug.

In the screenshot before you see my getOrganisationsBySlug functionality and I call there the page parameter “slug” for my API call. So I guess this parameter is empty.

Do I need to seperate the slug from the url and call a different but same API call?

I am looking forward for your reply :slight_smile:

Greetings Chris

So I have the solution after creating a support ticket. The problem is, that I am self hosting this project.

@rivan_sigarlaki send me this link. Self-hosting with dynamic routing | Documentation

I had to configure my .htaccess on my apache server.

Thx all for your help and I hope it can help other people too

2 Likes