Open navClose nav

Toggle Field,dpr_auto,f_auto,q_80,w_640/

A boolean toggle.


  • General
    • Label — the human-friendly label shown above the input field in the editor.
    • Name — the key stored in your content’s front matter, used to access it in your templates.
    • Description — a human friendly description of what the field does and/or instructions for your editors.
    • Hidden — hides the field in the editor, but allows developers to set default values or maintain the field for legacy purposes.
  • Default — set the default toggle state.


You can access this field in your templates using the field’s name:


{{ if .Params.is_featured }}
    // Do something special!
{{ end }}


{% if page.is_featured %}
    // Do something special!
{% endif %}


<div v-if="$page.frontmatter.is_featured">
  // Do something special!

Use a toggle to filter pages in a loop:


{{ range where .Data.Pages ".Params.is_featured" "eq" true }}
    <h2>{{ .Title }}</h2>
    <p>{{ .Description }}</p>
{{ end }}


{% for post in site.posts | where:"is_featured", "true" %}
    <h2>{{ page.title }}</h2>
    <p>{{ page.description }}</p>
{% endif %}


  <div class="featured-posts">
    <div v-for="post in featuredPosts" class="featured-post">
      <h2>{{ post.frontmatter.title }}</h2>
      <p>{{ post.frontmatter.description }}</p>
   export default {
    computed: {
      featuredPosts() {
        return this.$site.pages
          .filter(page => page.path.startsWith("/posts/")
          .filter(page => page.frontmatter.is_featured)

Config Files

You can configure this field in Front Matter Template Config Files as follows:

type: boolean
name: [String]
label: [String]
description: [String]
default: [true|false]
hidden: [true|false]


type: boolean
name: is_featured
label: Is Featured?
description: Mark this page as featured
default: true
hidden: false

Last updated on June 11, 2020