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

Inconstant contents #4

Closed
jondashkyle opened this issue Mar 13, 2014 · 8 comments
Closed

Inconstant contents #4

jondashkyle opened this issue Mar 13, 2014 · 8 comments

Comments

@jondashkyle
Copy link

Hey—unsure if this is a problem related to Metalsmith or this plugin. When I build the site the value of contents for each article sometimes changes.

For example, here's the value of contents of article one:
<p>A really short, rushed-feeling string of words.</p>

However, when I edit article two by adding a couple line breaks, the contents of article one becomes:

<html> <head> <title>My Blog</title> </head> <body> <h1>My Fourth Post</h1> <time>Thu Dec 06 2012 16:00:00 GMT-0800 (PST)</time> <p>A really short, rushed-feeling string of words.</p> </body> </html>

Any ideas?

@ianstormtaylor
Copy link
Contributor

hey, i haven't seen this before. can you make sure all the deps are up to date?

@daGrevis
Copy link

daGrevis commented May 3, 2014

This is somewhat related to metalsmith/metalsmith#52. {{contents}} is actual HTML from page.html template for me.

@daGrevis
Copy link

daGrevis commented May 4, 2014

@daGrevis
Copy link

daGrevis commented May 4, 2014

Also, it's possible that item one has template in it's contents, but second item in the same collection has contents without template.

@daGrevis
Copy link

daGrevis commented May 4, 2014

Yes, the same happens without excerpts plugin. Problem must be in collection plugin or core.

@Rowno
Copy link

Rowno commented Jun 7, 2014

I encountered this bug as well. My workaround is to render the pages in two passes. The first pass uses an exclude pattern to render everything except the collection and the second pass only renders the collection.

For example:

metalsmith(__dirname)
    .use(collections({
        posts: {
            pattern: 'blog/*.html',
            sortBy: 'date',
            reverse: true
        }
    }))
    .use(templates({
        pattern: '!blog/*.html',
        engine: 'nunjucks'
    }))
    .use(templates({
        pattern: 'blog/*.html',
        engine: 'nunjucks'
    }))
    .build();

@ianstormtaylor
Copy link
Contributor

Actually turned out to be a bug with metalsmith-templates, fixed with 0.5.1

@rgladwell
Copy link
Contributor

This still seems to be a problem with the latest versions of metalsmith/metalsmith-collections. I'm not using metalsmith-templates.

The value of {{{ contents }}} seem to change during different runs, possibly due to a thread/timing issue.

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

5 participants