---
import StarlightMarkdownContent from '@astrojs/starlight/components/MarkdownContent.astro'
import type { Props } from '@astrojs/starlight/props'
import config from 'virtual:starlight-ghostcms/config'
import Metadata from '../components/Metadata.astro'
import type { Post } from '../schemas/posts'

export function checkpath(path: string){
  return path.split('/').includes(config.route) ? true : false
}

const isBlog = checkpath(Astro.url.pathname)
let blogEntry: Post | undefined = undefined

---

<StarlightMarkdownContent {...Astro.props}>
  {isBlog && blogEntry ? <Metadata entry={blogEntry} /> : null}
  <slot />

  {
    isBlog && blogEntry ? (
      <div class="post-footer">
      </div>
    ) : null
  }
</StarlightMarkdownContent>

<style>
  .post-footer {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-block-start: 2rem !important;
  }
</style>
