prose / starter

A starter site for Jekyll + Prose
http://prose.github.io/starter
BSD 3-Clause "New" or "Revised" License
356 stars 1.08k forks source link

Metadata for static pages #29

Closed jdsimcoe closed 9 years ago

jdsimcoe commented 9 years ago

I have all of my static pages like about.md and contact.md in the root directory of my project. I can't seem to get the custom metadata editing to work for these entries. For files in _posts it works great. What am I missing?

Here is my Prose section of my _config.yml:

prose:
  rooturl: ''
  siteurl: 'http://meetcircle.co/'
  relativeLinks: 'http://meetcircle.co/links.jsonp'
  media: 'media'
  ignore:
    - public/
    - /_includes
    - /_layouts
    - /_sass
    - /blog
    - 404.html
    - .gitignore
    - _config.yml
    - atom.xml
    - links.jsonp
    - sitemap.xml
    - styles.scss
  metadata:
    _posts:
      - name: "layout"
        field:
          element: "hidden"
          value: "post"
      - name: "title"
        field:
          element: "text"
          label: "Title"
          value: ""
      - name: "nav"
        field:
          element: "select"
          label: "Navigation"
          placeholder: "Choose Nav type"
          options:
            - name: "None"
              value: "none"
            - name: "Primary"
              value: "primary"
            - name: "Secondary"
              value: "secondary"
            - name: "Support"
              value: "support"
    _site:
      - name: "layout"
        field:
          element: "hidden"
          value: "page"
      - name: "title"
        field:
          element: "text"
          label: "Title"
          value: ""
      - name: "nav"
        field:
          element: "select"
          label: "Navigation"
          placeholder: "Choose Nav type"
          options:
            - name: "None"
              value: "none"
            - name: "Primary"
              value: "primary"
            - name: "Secondary"
              value: "secondary"
            - name: "Support"
              value: "support"
dereklieu commented 9 years ago

Hi @jdsimcoe,

If you'd like to create metadata settings for your root directory, you can specify that using a pair of empty quotes in place of the parent directory. cc this commit.

For example:

 metadata:
    '':
      - name: "layout"
        field:
          element: "hidden"
          value: "page"
    _posts:
      - name: "layout"
        field:
          element: "hidden"
          value: "post"

The metadata settings you apply to the root directory will also apply to any child directories, unless you specify a more specific path, as I do above in _posts:.

In this case, markdown files in _posts will have a layout value of post, while everything else in your repo will have a layout value of page.

BTW, I noticed that you had written specific metadata rules for your _site directory. Since that directory is generated by Jekyll, you can probably remove those rules, since I don't think you would need to edit anything in there using prose.

Hope that helps.