antonlegoo / gitbook-plugin-theme-gestalt

A configurable theme for GitBook.
Apache License 2.0
17 stars 11 forks source link

BaseUrl does not get set #8

Open FroeMic opened 5 years ago

FroeMic commented 5 years ago

Even though the baseUrl property is set in the pluginConfig, it is not rendered in the html

{
  "plugins": ["theme-gestalt", "-theme-default", "styles-sass-fix" ],
  "pluginsConfig": {
    "theme-gestalt": {
       "logo": "/assets/images/logo-docs.png",
       "favicon": "/assets/images/favicon.ico", 
    "baseUrl": "http://campus.cdtm.de/docs",
    "excludeDefaultStyles": false,
    "doNotHideChildrenChapters": false
     }
  }
}
antonlegoo commented 5 years ago

I noticed in your original comment that the url was "http://campus.cdtm.de./docs". Try removing the extra dot if that's in your code.

The baseUrl property sets the HTML <base> element for the site. As defined by this documentation:

The HTML <base> element specifies the base URL to use for all relative URLs contained within a document.

That means the baseUrl won't be rendered in the HTML but the browser will treat the link as relative to what's set as baseUrl. For example, if baseUrl is set to http://campus.cdtm.de/docs, then a relative link of ./something will go to http://campus.cdtm.de/docs/something when clicked.

FroeMic commented 5 years ago

Hi @antonlegoo,

thanks for the response. To clarify: for some reason the <base> tag is not included in the rendered html files, even though the "baseUrl" property is set in the plugin configuration.

(The additional dot, was a typo indeed, but it doesn't affect the problem described above)