Skip to content

Commit

Permalink
#107 - How to override theme.css now? - enrich documentation from @nz…
Browse files Browse the repository at this point in the history
…bart's examples
  • Loading branch information
vjeantet committed Jan 14, 2018
1 parent 1617db8 commit 5f4eab7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion exampleSite/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ title = "Docdock"
theme = "hugo-theme-docdock"
themesdir = "../.."
pygmentsCodeFences = true
pygmentsStyle = "monokai"
pygmentsStyle = "monokailight"

[params]
editURL = "https://github.com/vjeantet/hugo-theme-docdock/edit/master/exampleSite/content/"
Expand Down
36 changes: 31 additions & 5 deletions exampleSite/content/content-organisation/customize-style/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,46 @@ You can change the style and behavior of the theme without touching it.
* inject your own html, css or js into the page
* overide existing css or js with your own files

## Inject your HTML
{{%notice note %}}
No needs to copy the entire theme to customize some parts
Bellow are solutions to avoid copying the entire theme into your own codebase.
{{%/notice%}}

### into the \<head\> part of each page :
## Add custom CSS and JS or HTML into the \<head\> part of each page :

Create a `custom-head.html` into a `layouts/partials` folder next to the content folder
Create a custom header partial `layouts/partials/custom-head.html`

> * content/
> * layouts/
> * partials/
> * custom-head.html
write your own content like (an example from @nzbart):
```html
<link rel="stylesheet" href="/css/custom.css">
<script src="/js/custom.js"></script>
```

Then overrode the style your want to change in `static/css/custom.css` (in this case, to avoid altering the casing of titles):
```css
h2 {
text-transform: none;
}
```

And executed some additional JavaScript from `static/js/custom.js` (note that jQuery is already loaded by the theme):
```javascript
function tweakPage() {
// make some changes here
}

$(tweakPage)
```


now feel free to add the JS, CSS, HTML code you want :)

### at the end of the body part of each page :
## Add custom HTML at the end of the body part of each page :

Create a `custom-footer.html` into a `layouts/partials` folder next to the content folder

Expand All @@ -32,7 +58,7 @@ Create a `custom-footer.html` into a `layouts/partials` folder next to the conte
now feel free to add the JS, CSS, HTML code you want :)

## overide existing CSS or JS
## Overide existing CSS or JS

Create the matching file in your static folder, hugo will use yours instead of the theme's one.
Example :
Expand Down

0 comments on commit 5f4eab7

Please sign in to comment.