How to install

  1. Run npm i contentlayer —save-dev.
  2. Create a content directory and markdown files.
  3. Create a contentlayer.config.js file.
  4. Expand Script section in package.json.
  5. Add code to your +page.svelte, +page.ts/.js.
  6. Run NPM to build or dev.
  7. Open the site within your webbrowser.

For details have a look into this repository to get hints.


Back to Home

Contentlayer is a fast and easy content SDK that validates and transforms the markdown content into type-safe JSON.

GitHub Repository, have a look into /src/routes/posts/[slug]/+page.ts line 13 and +page.svelte line 15.