Adding Layout Capabilities

To enable layout functionality, you need to create slots where partial pages will load. Here's how it works:

Minimal layout

    <html>
      <head>
        <script src="papel.js" defer></script>
      </head>
      <body>
        <main id="content">
          <slot>
            <h2> Hello World </h2>
          </slot>
        </main>
      </body>
    </html>
        

Named Slots

You can create named slots in your layout by adding the name attribute to any slot. Named slots allow you to load partial content that matches the slot's name.

Named slots

    <html>
      <head>
        <script src="papel.js" defer></script>
      </head>
      <body>
        <header>
          <slot name="header">
            <h2> Default Header </h2>
          </slot>
        </header>
        <main>
          <slot>
            <h2> Hello World </h2>
          </slot>
        </main>
      </body>
    </html>
        

In this example:

This makes it easy to organize your layout and target specific areas with partial content.