# Stripping frontmatter

**URL:** https://community.silverbullet.md/t/stripping-frontmatter/3419
**Category:** Troubleshooting
**Created:** [October 19, 2025, 3:46pm UTC](https://community.silverbullet.md/t/stripping-frontmatter/3419 "2025-10-19T15:46:24Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![Mr.Red](https://community.silverbullet.md/user_avatar/community.silverbullet.md/mr.red/32/821_2.png) [@Mr.Red](https://community.silverbullet.md/u/Mr.Red)
#### Post date: [October 19, 2025, 4:29pm UTC](https://community.silverbullet.md/t/stripping-frontmatter/3419/2 "2025-10-19T16:29:41Z")

</div>

there already is a functions to strip a text from its frontmatter [API/index Documentation](https://silverbullet.md/API/index)

`index.extractFrontmatter(text, extractOptions)`

## To strip a frontmatter from a page:

```auto
function strip_frontmatter_page(page)
  local fm = index.extractFrontmatter(space.readPage(page), {
    removeFrontMatterSection = true,
    removeTags = false
  })
  return fm.text
end

```

## To strip frontmatter from a text

```auto
function strip_frontmatter_from_text(text)
  local fm = index.extractFrontmatter(text, {
    removeFrontMatterSection = true,
    removeTags = false
  })
  return "Text without frontmatter: " .. fm.text .."\n\nAnd this is the frontmatter:" .. fm.frontmatter
end

```

here is a screenshot with the result for `fm`

 ![image](https://community.silverbullet.md/uploads/default/original/2X/b/b9f48b6967bace2ca40e226a98e007c1f3f86b41.png)

---

_[View the full topic](https://community.silverbullet.md/t/stripping-frontmatter/3419)._
