linkedin / linkedin/dustjs

How to render dust template located in different folders?

Open
#707 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
2.9k
Forks
461
PR merge metrics
No merged PRs in 30d

Description

Hi,

I have the following set up:

app.engine('dust', engines.dust);
app.set('view engine', 'dust');
app.set('views', path.join(__dirname, path.join('public', 'templates')));

Now in /public/templates/ i have many subfolders. For expl sub1, sub2 where my templates are located. How can i from the folder /routes/sub1/ render the templates located in /public/templates/sub1.

I have try this:
res.render('sub1/index', {title: 'Sub1'});
res.render('sub1.index', {title: 'Sub1'});

but this don't work

Regards
Micky

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start from the Express view configuration shown in the issue and review how the Dust engine resolves views under the configured `views` directory. Reproduce the `res.render('sub1/index', ...)` and `res.render('sub1.index', ...)` examples; done means the documented configuration or usage reliably renders a template from `public/templates/sub1`.

Written by the indexing model from the issue text.

Assessment

Tech stack
express, javascript
Domain
backend
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.