mourner / tinyjam

A radically simple, zero-configuration static site generator in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Question] How to find current file name?

shivajivarma opened this issue · comments

Is there any variable, where I can know current filename?

On template conditionally parsing some content based on page, currently I'm defining variable on each page to identify it. But want to know if there is alternative way to identity the file.

Hmm, not at the moment looking at the code, but that's a good point! We should add this.

tinyjam/index.js

Lines 105 to 107 in 78818d0

const {body, attributes} = parseFrontMatter(fs.readFileSync(path, 'utf8'));
data[name] = createCtx(rootPath, {...attributes, body: marked(body, markedOptions)});