diff options
author | Hang Jiang <jianghangscu@gmail.com> | 2021-08-16 07:11:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-16 07:11:13 +0300 |
commit | 23c428dcfbf7a49c46ca2bd6220198d2d1cbaea5 (patch) | |
tree | db8a3424248316f6e72027ce4b94df56b0ea69de | |
parent | 9061e430217508650a88956d1aa06e255917856c (diff) | |
parent | cbd2f451c2e077bc19dba8df71f832a709c4bc5e (diff) |
Merge pull request #98 from nodejh/feature/custom-style
Support Custom CSS and Custom JS
-rw-r--r-- | README-zh_CN.md | 15 | ||||
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | exampleSite/config.yaml | 12 | ||||
-rw-r--r-- | exampleSite/content/posts/test.md | 33 | ||||
-rw-r--r-- | layouts/partials/comment.html | 12 | ||||
-rw-r--r-- | layouts/partials/footer.html | 10 | ||||
-rw-r--r-- | layouts/partials/head.html | 11 |
7 files changed, 101 insertions, 8 deletions
diff --git a/README-zh_CN.md b/README-zh_CN.md index 5add95f..34ff44a 100644 --- a/README-zh_CN.md +++ b/README-zh_CN.md @@ -148,6 +148,21 @@ enableComments = false +++ ``` +### 3.2 自定义 CSS 和 JS + +你可以将自定义 CSS 和 JS 放在 `static` 中,也可以使用远程的 CSS 或 JS 文件。 + +例如: + +```yaml +customCSS: + - css/custom.css # local css in `static/css/custom.css` + - https://example.com/custom.css # remote css +customJS: + - js/custom.js # local js in `static/js/custom.js` + - https://example.com/custom.js # remote js +``` + ## License @@ -147,6 +147,22 @@ enableComments = false +++ ``` +### 3.2 Custom CSS and JS + +You can put your custom css and js files to `static` directory, or use remote css and js files which start with `http://` or `https://`. + +For example: + +```yaml +customCSS: + - css/custom.css # local css in `static/css/custom.css` + - https://example.com/custom.css # remote css +customJS: + - js/custom.js # local js in `static/js/custom.js` + - https://example.com/custom.js # remote js +``` + + ## License [MIT](https://github.com/nodejh/hugo-theme-mini/blob/master/LICENSE.md) diff --git a/exampleSite/config.yaml b/exampleSite/config.yaml index bf4b20e..0a7ba90 100644 --- a/exampleSite/config.yaml +++ b/exampleSite/config.yaml @@ -62,6 +62,16 @@ params: # Extra links in navigation links: - # e.g. + ## e.g. # - name: Project # path: /project + + # You can put your custom css and js to `static` directory, or use remote css and js files which start with `http://` or `https://` + customCSS: + ## e.g. + # - css/custom.css # local css in `static/css/custom.css` + # - https://example.com/custom.css # remote css + customJS: + ## e.g. + # - js/custom.js # local js in `static/js/custom.js` + # - https://example.com/custom.js # remote js
\ No newline at end of file diff --git a/exampleSite/content/posts/test.md b/exampleSite/content/posts/test.md new file mode 100644 index 0000000..bf9136c --- /dev/null +++ b/exampleSite/content/posts/test.md @@ -0,0 +1,33 @@ ++++ +author = "Test" +title = "Code Content" +date = "2021-03-10" +description = "A brief description of Hugo Shortcodes" +tags = [ + "shortcodes", + "privacy", +] ++++ + +超宽显示 `var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";var a = "text";` 超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示超宽显示 `var a = "text";` + +``` +2021-08-02 17:51:23.718 ERROR org.apache.flink.runtime.entrypoint.ClusterEntrypoint [] - Fatal error occurred in the cluster entrypoint. +org.apache.flink.util.FlinkException: Application failed unexpectedly. + at org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.lambda$runApplicationAndShutdownClusterAsync$0(ApplicationDispatcherBootstrap.java:170) ~[flink-dist_2.12-1.13.1.jar:1.13.1] + at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:836) ~[?:1.8.0_292] + at java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:811) ~[?:1.8.0_292] + at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:488) ~[?:1.8.0_292] + at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1990) ~[?:1.8.0_292] + at org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.runApplicationEntryPoint(ApplicationDispatcherBootstrap.java:257) ~[flink-dist_2.12-1.13.1.jar:1.13.1] + at org.apache.flink.client.deployment.application.ApplicationDispatcherBootstrap.lambda$runApplicationAsync$1(ApplicationDispatcherBootstrap.java:212) ~[flink-dist_2.12-1.13.1.jar:1.13.1] + at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_292] + at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_292] + at org.apache.flink.runtime.concurrent.akka.ActorSystemScheduledExecutorAdapter$ScheduledFutureTask.run(ActorSystemScheduledExecutorAdapter.java:159) [flink-dist_2.12-1.13.1.jar:1.13.1] + at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) [flink-dist_2.12-1.13.1.jar:1.13.1] + at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44) [flink-dist_2.12-1.13.1.jar:1.13.1] + at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) [flink-dist_2.12-1.13.1.jar:1.13.1] + at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) [flink-dist_2.12-1.13.1.jar:1.13.1] + at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) [flink-dist_2.12-1.13.1.jar:1.13.1] +``` + diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index d4d9dd5..f7a16a8 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -1,8 +1,6 @@ -{{ if .Site.Params.enableComments }} - {{ if ne .Params.enableComments false }} - <div id="comment"> - <!-- https://gohugo.io/templates/internal/#use-the-disqus-template --> - {{ template "_internal/disqus.html" . }} - </div> - {{ end }} +{{ if or (and .Site.Params.enableComments (ne .Params.enableComments false)) (eq .Params.enableComments true) }} + <div id="comment"> + <!-- https://gohugo.io/templates/internal/#use-the-disqus-template --> + {{ template "_internal/disqus.html" . }} + </div> {{ end }}
\ No newline at end of file diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 899b551..833c955 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -22,3 +22,13 @@ </div> {{ end }} </footer> + +{{ range .Site.Params.customJS }} + {{ if ( or ( hasPrefix . "http://" ) ( hasPrefix . "https://" ) ) }} + <!-- remote js --> + <script src="{{ . }}"></script> + {{ else }} + <!-- local js --> + <script src="{{ $.Site.BaseURL }}{{ . }}"></script> + {{ end }} +{{ end }} diff --git a/layouts/partials/head.html b/layouts/partials/head.html index 277b8c7..79d9236 100644 --- a/layouts/partials/head.html +++ b/layouts/partials/head.html @@ -11,6 +11,17 @@ {{ end }} <link rel="stylesheet" href="{{ "/css/style.css" | relURL }}"> + +{{ range .Site.Params.customCSS }} + {{ if ( or ( hasPrefix . "http://" ) ( hasPrefix . "https://" ) ) }} + <!-- remote css --> + <link rel="stylesheet" href="{{ . }}"> + {{ else }} + <!-- local css --> + <link rel="stylesheet" href="{{ $.Site.BaseURL }}{{ . }}"> + {{ end }} +{{ end }} + <link rel="shortcut icon" href="{{ "/images/favicon.ico" | relURL }}" type="image/x-icon" /> {{ if .Site.Params.enableGoogleAnalytics }} |