docpad-plugin-partials icon indicating copy to clipboard operation
docpad-plugin-partials copied to clipboard

Unnecessary hard-coding of src/partials during render

Open julrichkieffer opened this issue 9 years ago • 0 comments

The partial plugin creates a custom query to discover partial documents:

.setQuery('isPartial', {
	$or:
		isPartial: true
		fullPath: $startsWith: config.partialsPath  # src/partials
})

Notably, $or: allows a document to be discovered outside of the src/partials folder by merely including isPartial: true in the metadata. However, when time to render the documents, the below is hardcoded, making partials outside the src/partials folder give rise to an error:

partialFuzzyPath = pathUtil.join(config.partialsPath, partialName)
partial.document ?= docpad.getCollection('partials').fuzzyFindOne(partialFuzzyPath)

julrichkieffer avatar Dec 09 '16 18:12 julrichkieffer