Blame
|
1 | # Customization |
||||||
| 2 | ||||||||
| 3 | ## Theme Customization |
|||||||
|
4 | |||||||
| 5 | An Otter Wiki was not designed with the idea that user-defined topics might become necessary. However, since there is a need, a way to modify the theme has been added. |
|||||||
| 6 | ||||||||
| 7 | If you've made improvements that you'd like to share, don't forget, pull requests are always welcome. Or upon up an [issue](https://github.com/redimp/otterwiki/issues) post your code and a screenshot. |
|||||||
| 8 | ||||||||
| 9 | Check [otterwiki/docs/custom_css_example](https://github.com/redimp/otterwiki/tree/main/docs/custom_css_example) on github for ready-to-test examples. |
|||||||
| 10 | ||||||||
|
11 | ### `custom directory` |
||||||
|
12 | |||||||
|
13 | With version **2.3.1** the template loads a `custom.css` and a `custom.js` which are empty by default. You can mount the directory into the container, for example with a `docker-compose.yaml` like this: |
||||||
|
14 | |||||||
| 15 | ```yaml |
|||||||
| 16 | version: '3' |
|||||||
| 17 | services: |
|||||||
| 18 | otterwiki: |
|||||||
| 19 | image: redimp/otterwiki:2 |
|||||||
| 20 | restart: unless-stopped |
|||||||
| 21 | ports: |
|||||||
| 22 | - 8080:80 |
|||||||
| 23 | volumes: |
|||||||
| 24 | - ./app-data:/app-data |
|||||||
| 25 | # a custom local directory with a custom.css and a custom.js |
|||||||
| 26 | - ./custom:/app/otterwiki/static/custom |
|||||||
| 27 | ``` |
|||||||
| 28 | ||||||||
|
29 | ### Examples |
||||||
|
30 | |||||||
|
31 | #### Serif Pages |
||||||
|
32 | |||||||
| 33 | This is an example custom.css that uses the serif font |
|||||||
| 34 | `Baskervville` for the content rendered in the page. |
|||||||
| 35 | ||||||||
| 36 | ```css |
|||||||
| 37 | @import url('https://fonts.googleapis.com/css2?family=Baskervville'); |
|||||||
| 38 | ||||||||
| 39 | .content > .page { |
|||||||
| 40 | font-family: 'Baskervville', serif; |
|||||||
| 41 | font-weight: 400; |
|||||||
| 42 | } |
|||||||
| 43 | ``` |
|||||||
| 44 | ||||||||
|
45 |  |
||||||
|
46 | |||||||
| 47 | > [!NOTE] |
|||||||
| 48 | > In case of a local deployment the browser might cache the web app, so users are recommended to clear cookies and site data if the changes to `custom.js` or `custom.css` are not visible immediately even after restarting the docker |
|||||||
|
49 | |||||||
| 50 | ## Tweaking the HTML head and body |
|||||||
| 51 | ||||||||
| 52 | The HTML body and head of every html rendered can be tweaked via `HTML_EXTRA_HEAD` and `HTML_EXTRA_BODY`. |
|||||||
| 53 | ||||||||
| 54 | This can be used for small tweaks, e.g. adding the "Fork me on github" ribbon: |
|||||||
| 55 | ||||||||
| 56 | ```yaml |
|||||||
| 57 | services: |
|||||||
| 58 | otterwiki: |
|||||||
| 59 | image: redimp/otterwiki:2 |
|||||||
| 60 | restart: unless-stopped |
|||||||
| 61 | ports: |
|||||||
| 62 | - 8080:80 |
|||||||
| 63 | environment: |
|||||||
| 64 | HTML_EXTRA_HEAD: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" /> |
|||||||
| 65 | HTML_EXTRA_BODY: <a class="github-fork-ribbon right-bottom" href="https://url.to-your.repo" data-ribbon="Fork me on GitHub" title="Fork me on GitHub">Fork me on GitHub</a> |
|||||||
| 66 | volumes: |
|||||||
| 67 | - ./app-data:/app-data |
|||||||
| 68 | ``` |
|||||||
| 69 | ||||||||
| 70 |  |
|||||||
