Jekyll: It doesn't regenerate when you turn it on the docker.

Asked 1 years ago, Updated 1 years ago, 94 views

Hello.

Refer to the following locally for ruby-based jekyll.

jekyll serve

When turning on the docker, the command was done as follows using the absolute path.

docker run --name blog -v "C:/dev/record/blog:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll jekyll serve

Even if I modified the file, it was not being watched. Locally, it is automatically regenerated just like above. So, I put --watch at the end of the docker command, but I don't recognize the file modification. Could you help me with what to do?

Thank you.

ruby jekyll docker

2022-09-22 19:09

1 Answers

After solving it, there is no answer, so I will answer myself. I don't know why because I don't have enough data.

In my case, when I saw a message telling me to google --force_polling --liberload and put it on the docker command, the regeneration was very good. The overall docker command is as follows.

docker run --name blog -v "<DIRECTORY>:/srv/jekyll" -p 4000:4000 -it jekyll/jekyll jekyll serve

I solved another problem this time. I have used liquid statement for my blog postmarkdown file for tutorial. The following form is

{% include head.html %}

If I just use the liquid, it will work, so I used it as follows after escaping it.

{{ "{% include head.html " }}%}

When I turn the server to be protected locally, if I do Escaping as above, there is no error, but if I turn it on the docker, the following error appears.

Error: A Liquid tag in the excerpt of ./<FILENAME>.md couldn't be parsed.
Error: could not read file /srv/jekyll/<FILENAME>.md: undefined method `ancestors' for nil:NilClass

Unexpectedly, it was a simple problem to solve. If you wrap the liquid statement above as below, it has been solved.

{% raw %}
  {% {% include head.html %}
{% {% endraw %}

Of course, you can wrap several liquid blocks as below.

{% raw %}
  {% {% if %}
    {% {% include head.html %}
  {% {% endif %}
{% {% endraw %}


2022-09-22 19:09

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.