def to_api(include_content: false)
      output = hash_for_api
      output = output.merge(url_fields)

      # Include content, if requested, otherwise remove it
      if include_content
        output = output.merge(content_fields)
      else
        CONTENT_FIELDS.each { |field| output.delete(field) }
      end

      # Documents have duplicate output and content fields, Pages do not
      # Since it's an API, use `content` in both for consistency
      output.delete("output")

      # By default, calling to_liquid on a collection will return a docs
      # array with each rendered document, which we don't want.
      if is_a?(Jekyll::Collection)
        output.delete("docs")
        output["entries_url"] = entries_url
      end

      if is_a?(Jekyll::Document)
        output["relative_path"] = relative_path.sub("_drafts/", "") if draft?
        output["name"] = basename
      end

      if is_a?(Jekyll::StaticFile)
        output["from_theme"] = from_theme_gem?
      end

      output
    end
def to_api(include_content: false)
      output = hash_for_api
      output = output.merge(url_fields)

      # Include content, if requested, otherwise remove it
      if include_content
        output = output.merge(content_fields)
      else
        CONTENT_FIELDS.each { |field| output.delete(field) }
      end

      # Documents have duplicate output and content fields, Pages do not
      # Since it's an API, use `content` in both for consistency
      output.delete("output")

      # By default, calling to_liquid on a collection will return a docs
      # array with each rendered document, which we don't want.
      if is_a?(Jekyll::Collection)
        output.delete("docs")
        output["entries_url"] = entries_url
      end

      if is_a?(Jekyll::Document)
        output["relative_path"] = relative_path.sub("_drafts/", "") if draft?
        output["name"] = basename
      end

      if is_a?(Jekyll::StaticFile)
        output["from_theme"] = from_theme_gem?
      end

      output
    end
Returns a hash suitable for use as an API response.

 For Documents and Pages:

 1. Adds the file's raw content to the `raw_content` field
 2. Adds the file's raw YAML front matter to the `front_matter` field

 For Static Files it addes the Base64 `encoded_content` field

 Options:

 include_content - if true, includes the content in the respond, false by default
                   to support mapping on indexes where we only want metadata


 Returns a hash (which can then be to_json'd)