mkdir custom-helpers/{default,async} directory with your default/syncHelper.js or async/asyncHelper.js hbs helperscustom-helpers/ directory is copied into the containers working directory (COPY custom-helpers custom-helpers or mount via -v flag)The problem with the current Ghost 3.x version is that it not only does not have any interface for adding custom template helpers
but it also prevents you from manipulating it by its dependency gscan which will check if you are ONLY using official Ghost helpers - if not: page throws an error.
This image fixes this by copying over the custom-helpers to the official ghost installation, registering them and also putting them to the knownHelpers in gscan therefore making it valid.
For details of the implementation feel free to checkout https://github.com/activenode/ghost-docker-custom-helpers
myName.js helper// filename = myName.js - do NOT use dashes since they are not valid function names
// and therefore also not valid filenames here!
module.exports = function myName(options) {
return 'hello there';
};
FROM activenode/ghost-docker-custom-helpers:latest
if you want to run your own scripts before startup of Ghost do the following:
FROM activenode/ghost-docker-custom-helpers:latest
# this tells the script that it should run a before.sh file before startup
ENV EXECUTE_BEFORE_STARTUP before.sh
# making sure to delete the preset helpers (you can keep them but you dont need them)
RUN rm -rf custom-helpers
COPY . .
docker rundocker run --publish 8000:10000 --detach -v /HOST/content:/var/lib/ghost/content -v /HOST/custom-helpers:/var/lib/ghost/custom-helpers activenode/ghost-docker-custom-helpers:latest
Content type
Image
Digest
Size
125.1 MB
Last updated
over 5 years ago
docker pull activenode/ghost-docker-custom-helpers