copyright customizing added

This commit is contained in:
zzossig 2019-12-26 19:39:34 +09:00
parent 4cfd38b339
commit 159e6cbcdc
5 changed files with 83 additions and 6 deletions

View File

@ -114,7 +114,7 @@ hasCJKLanguage = true # Set `true` for Chinese/Japanese/Korean languages.
summaryLength = 70 # The length of a post description on a list page.
copyright = "©{year}, All Rights Reserved" # copyright symbol: $copy; current year: {year}
copyright = "©{year}, All Rights Reserved" # copyright symbol: $copy; current year: {year}
timeout = 10000
enableEmoji = true
paginate = 13 # Number of items per page in paginated lists.
@ -245,7 +245,7 @@ enableSidebar = true # Set to false to create the full width of the content.
enableSidebarTags = true # if you want to use tags.
enableSidebarSeries = true
enableSidebarCategories = true
enableToc = true # single page table of contents
enableToc = true # single page table of contents, you can replace this param to toc(toc = true)
hideToc = false # Hide or Show toc
enableTocSwitch = true # single page table of contents visibility switch
itemsPerCategory = 5 # maximum number of posts shown in the sidebar.
@ -340,6 +340,12 @@ commento = false
wechat = "" # Wechat pay QR Code image (example path: same as above)
paypal = "" # Paypal URL
patreon = "" # Patreon URL
[copyrightOptions]
enableCopyrightLink = false # if set, you can add copyright link
copyrightLink = ""
copyrightLinkImage = ""
copyrightLinkText = ""
```
## Layout
@ -795,6 +801,28 @@ root/layouts/partials/head/custom-head.html 경로에 파일을 만드시고 폰
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+KR:400,700&display=swap&subset=korean" rel="stylesheet">
```
### custom copyright
footer의 저작권 텍스트에 링크를 넣고 싶으면 다음과 같이 커스터마이징 하면 됩니다.
1. 설정 파일인 config.toml 에서 copyright 파라미터 값을 설정해주세요.
```toml
...
copyright = This is my {} copyright text
...
```
{} 로 쓰여진 부분이 링크가 들어갈 부분입니다.
2. 설정 파일인 params.toml 에서 copyrightOptions 파라미터 값을 설정해주세요.
```toml
...
[copyrightOptions]
enableCopyrightLink = false
copyrightLink = "https://..."
copyrightLinkImage = "https://..."
copyrightLinkText = "copyright link text"
```
## External Library
현재 지원하는 외부 라이브러리는 Katex, MathJax, Mermaid, Flowchart.js, chart.js, viz-graph, wavedrom, js-sequence-diagram 입니다. front-matter에 값을 넣어주시면 해당 라이브러리가 로드됩니다.

View File

@ -109,7 +109,7 @@ hasCJKLanguage = true # Set `true` for Chinese/Japanese/Korean languages.
summaryLength = 70 # The length of a post description on a list page.
copyright = "&copy;{year}, All Rights Reserved" # copyright symbol: $copy; current year: {year}
copyright = "©{year}, All Rights Reserved" # copyright symbol: $copy; current year: {year}
timeout = 10000
enableEmoji = true
paginate = 13 # Number of items per page in paginated lists.
@ -240,7 +240,7 @@ enableSidebar = true # Set to false to create the full width of the content.
enableSidebarTags = true # if you want to use tags.
enableSidebarSeries = true
enableSidebarCategories = true
enableToc = true # single page table of contents
enableToc = true # single page table of contents, you can replace this param to toc(toc = true)
hideToc = false # Hide or Show toc
enableTocSwitch = true # single page table of contents visibility switch
itemsPerCategory = 5 # maximum number of posts shown in the sidebar.
@ -335,6 +335,12 @@ commento = false
wechat = "" # Wechat pay QR Code image (example path: same as above)
paypal = "" # Paypal URL
patreon = "" # Patreon URL
[copyrightOptions]
enableCopyrightLink = false # if set, you can add copyright link
copyrightLink = ""
copyrightLinkImage = ""
copyrightLinkText = ""
```
## Layout
@ -795,6 +801,28 @@ Make a file at root/layouts/partials/head/custom-head.html and then load font st
<link href="https://fonts.googleapis.com/css?family=Noto+Sans+KR:400,700&display=swap&subset=korean" rel="stylesheet">
```
### custom copyright
If you want to add a link to the footer copyright, not just a text, you can customize it.
1. In your config.toml file, set the copyright param like this.
```toml
...
copyright = This is my {} copyright text
...
```
The {} part will be your copyright link.
2. In your params.toml file, set the copyrightOptions params
```toml
...
[copyrightOptions]
enableCopyrightLink = false
copyrightLink = "https://..."
copyrightLinkImage = "https://..."
copyrightLinkText = "copyright link text"
```
## External Library
If you want use external libraries, this theme currently supporting Katex, MathJax, Mermaid, Flowchart.js, chart.js, viz-graph, wavedrom, js-sequence-diagram. Just add some variable to a front-matter.

View File

@ -28,6 +28,16 @@
}
}
&__copyright {
&--img {
margin-bottom: 0.25rem;
@include flexbox();
@include align-items(center);
@include justify-content(center);
}
}
.dropdown {
position: absolute;
left: 0.5rem;

View File

@ -10,7 +10,18 @@
{{ if $.Site.Copyright }}
<p class="caption">
{{ with $.Site.Copyright }}{{ replace . "{year}" now.Year | markdownify}}{{ end }}
{{ if $.Site.Params.copyrightOptions.enableCopyrightLink }}
{{ $leftString := replace (index (split $.Site.Copyright "{}") 0) "{year}" now.Year }}
{{ $rightString := replace (index (split $.Site.Copyright "{}") 1) "{year}" now.Year }}
{{ if and ($.Site.Params.copyrightOptions.copyrightLinkImage) ($.Site.Params.copyrightOptions.copyrightLinkText) }}
<a rel="license" href="{{ $.Site.Params.copyrightOptions.copyrightLink }}" class="footer__copyright--img"><img alt="{{ $.Site.Params.copyrightOptions.copyrightLinkText }}" style="border-width:0" src="{{ $.Site.Params.copyrightOptions.copyrightLinkImage }}"/></a>{{ $leftString }}{{ $rightString }}
{{ else }}
{{ $leftString }}<a rel="license" href="{{ $.Site.Params.copyrightOptions.copyrightLink }}">{{ $.Site.Params.copyrightOptions.copyrightLinkText }}</a>{{ $rightString }}
{{ end }}
{{ else }}
{{ with $.Site.Copyright }}{{ replace . "{year}" now.Year | markdownify}}{{ end }}
{{ end }}
</p>
{{ end }}
<p class="caption">Powered by <a href="https://gohugo.io/" rel="noreferrer">Hugo</a> and the <a href="https://github.com/zzossig/hugo-theme-zzo" rel="noreferrer">Zzo theme</a></p>