jade in docpad can't include files

85 Views Asked by At

I have index.html.jade file:

extends ../layouts/default.html.jade
block title
  title Index page


include ../partials/page-title.jade
  section#blog-content
    .container
      .row
        .col-lg-12.col-md-12
          .blogArchive-area
            .row
              .col-md-9
                .blog-content
                  .single-blog
                    .single-blog-left
                      include ../partials/comment-box-left.jade
                    .single-blog-right
                      .post-item
                        .post-image
                          .row
                            .col-md-12
                              .img-wrapper
                                include ../partials/post-image.jade

and I have 3 partials in partials folder:

partials/page-title.jade
partials/comment-box-left.jade
and partials/post-image.jade

But when I using docpad run index.html not render code in some partials files. Please help me to fix it

1

There are 1 best solutions below

0
Steve Mc On

Docpad handles partials using the partials plugin. Once installed, you include a partial in your layout or page with the != partial('some-page').

The plugin knows where your partials folder is, so you don't need to include it in the partial method parameter.

In your case your file should look something like this:

---
layout: default
---
block title
  title Index page


!= partial('page-title')
  section#blog-content
    .container
      .row
        .col-lg-12.col-md-12
          .blogArchive-area
            .row
              .col-md-9
                .blog-content
                  .single-blog
                    .single-blog-left
                      != partial('comment-box-left')
                    .single-blog-right
                      .post-item
                        .post-image
                          .row
                            .col-md-12
                              .img-wrapper
                                != partial('post-image')

Note also that your layout is included as a metadata attribute at the top of the page.