#/favicon.svg Treated as slug

2 messages · Page 1 of 1 (latest)

inner goblet
#

I've a route at src/pages/[slug].astro
but when I go to routes like http://localhost:4321/admin/posts/new

the app is kind of rendering the slug page I thing?

because, this is the code for my slug page

---
import BaseLayout from "../layouts/BaseLayout.astro";
import BlogPostLayout from "../layouts/BlogPostLayout.astro";
import { pocketbase } from "../lib/pb/pocketbase";

const { slug } = Astro.params;

let post = await pocketbase
  .collection("posts")
  .getFirstListItem(`slug="${slug}"`);
---

<BaseLayout>
  <BlogPostLayout>
    <h1>{post.title}</h1>
    <Fragment set:html={post.content} />
  </BlogPostLayout>
</BaseLayout>

so when I visit the http://localhost:4321/admin/posts/new an error is thrown from this function for getting post.

What could be the issue?

vocal copper
#

Where is the <a> tag you are using to route to this page? It looks like you are passing in the wrong value for the slug