Specying 'url: https://domain.com' has no effect

Hello,

I’ve specified the url parameter in _config.yml

url: https://domain.com 

But nothing changes, and all weblinks on the site are still going to:

0.0.0.0:4000/<the page>

Is there another way to specify the hosts domain?

Unfortunately the container has been restarted; I even destroyed and recreated it from the compose. :frowning:

Here is my snippet for docker-compose:

  jekyll:
    container_name: jekyll
    image: jekyll/jekyll:latest
    command: jekyll serve --config _config.yml --watch --force_polling --verbose --livereload
    profiles:
      - isolation
#    security_opt:
#       - no-new-privileges:true
    networks:
       - Mars
    restart: always
    volumes:
      - $DOCKER_APPDATA/jekyll/mainsail_original/mainsail/docs:/srv/jekyll
    ports:
      - 5676:4000

And the contents of _config.yml:

title: "Mainsail"
tagline: A web interface for Klipper
description: Mainsail is a lightweight & responsive web interface for the Klipper 3D printer firmware. It communicates with Moonraker (Klipper-API) from Arksine.
logo: "/assets/img/logo-mainsail.png"
# theme: just-the-docs
remote_theme: pmarsceill/just-the-docs
color_scheme: "mainsail"
search_enabled: true
aux_links:
  "Mainsail on GitHub":
    - "//github.com/meteyou/mainsail"
aux_links_new_tab: true

url: https://domain.com

defaults:
  -
    scope:
      path: "" # an empty string here means all files in the project
    values:
      image: assets/img/rtfm.png

are you doing serve or build as the command? serve I think swaps out the url for localhost as it is for local dev.

Ah! Good point @rdyar@tomlawesome is using jekyll serve, which treats site.url differently depending on the version. Jekyll 4 always uses the given url, but Jekyll 3 ignores url in the default development mode. To force Jekyll 3’s serve command to use site.url, the production flag must be set like this:

JEKYLL_ENV=production jekyll serve ...
1 Like

However, the community feels the behavior in Jekyll 4.2.0 needs to be reverted…
ref: https://github.com/jekyll/jekyll/pull/7253#issuecomment-777653085
and https://github.com/jekyll/jekyll/pull/8620

Oh right. Wasn’t aware! Thank you guys, this works!

For clarity in case someone else searches the forum in future my situation is this:

  • Jekyll in a docker container
  • traefik reverse proxy pointing at the container
  • https://sub.domain.com hosting pointing at traefik
  • All links (other than main page) were pointing to 0.0.0.0:4000/

The fix for me, was to edit my compose snippet to add the following:

  environment:
     - JEKYLL_ENV=production

Edit my _config.yml to include the following parameters:

url: https://sub.domain.com
baseurl: ''

Without the baseurl: ‘’ parameter the site would not load/build.

As an aside, I actually put the config in '_config.dev.yml and specified this config as an extra parameter in the serve command to overwrite/add to the original _config.yml allowing different settings to only apply if I serve jekyll with the command (in docker-compose snippet):

  jekyll:
    command: jekyll serve --config _config.yml,_config.dev.yml --watch --force_polling --verbose --livereload