base.astro 1.02 KB
---
import { getSitePage } from '@lib/api.ts'
import { appendClasses } from '@lib/html.ts'
import { Node, Replace } from '@lib/astro.ts'
import '@config.ts'

const { data: layoutHtml } = await getSitePage('msd', '/')
const layoutReplacements = {
  ['body']: 'body',
  ['.hero-section']: 'content',
  ['.content-section']: 'DELETE',
  ['.content-section-4']: 'DELETE',
  //['a.w-webflow-badge']: 'DELETE',
  //['.navbar.w-nav:nth-child(n + 1)']: 'DELETE',
  [':nth-child(n + 1 of .navbar.w-nav)']: 'DELETE',
  // The following is not implemented yet
  //['.navbar.w-nav:nth-of-type(n + 1)']: 'DELETE',
}
---
<Replace html={layoutHtml} replacements={layoutReplacements}>
  <define slot="DELETE">{(node) => ''}</define>
  <define slot='body'>{(node, context) => <Node {...context} node={appendClasses(node, 'astro')} parent={node.parent}/>}</define>
  <define slot='content'>{(node) => <div><slot/></div>}</define>
</Replace>
<style>
  .astro {}
  a.w-webflow-badge {
    display:none;
  }
  :global(a.w-webflow-badge) {
    display:none;
  }
</style>