Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling collections property in template returns '0' #49

Closed
rachelng opened this issue Dec 24, 2015 · 0 comments
Closed

Calling collections property in template returns '0' #49

rachelng opened this issue Dec 24, 2015 · 0 comments

Comments

@rachelng
Copy link

I'm currently trying to put together an index page but I can't seem to call the collection in one of my files without it returning '0' or undefined. Any ideas?

My current file structure:

src
  |-- posts
     |-- index.html
     |-- category1
          |-- post.md
     |-- category2
     |-- category3
layouts
  |-- post.html

This is what I'm calling in posts/index.html

{% for cat in collections.category1 %}
   <li>{{ cat.title }}</li>
{% endfor %}

This is my index.coffee

metalsmith __dirname
      .use define
        config:
          environment: 'develop'
      .use collections
        'category1':
          pattern: 'posts/category1/*.md'
        'category2':
          pattern: 'posts/category2/*.md'
        'category3':
          pattern: 'posts/category3/*.md'
      .use markdown
      .use permalinks
        pattern: 'posts/:collection/:url'
        relative: false
      .use layouts
        engine: 'swig'
        partials: 'partials'
        pattern: '**/*.html'
      .use inPlace 
        engine: 'swig'
        partials: 'partials'
      .use sass
        outputStyle: 'compressed'
      .use autoprefixer()
      .use htmlMinify
        removeAttributeQuotes: false
      .use uglify()
      .build (error) ->
        if error
          console.log error

I'm still pretty new at this and I've tried to dig through similar issues but none of the solutions worked for me. Any help would be appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants