mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
feat: add shortcode for attachments
This commit is contained in:
parent
da208441c0
commit
951e8fb40e
16 changed files with 83 additions and 10 deletions
|
@ -1,10 +1,11 @@
|
||||||
- sticky bar -> TODO
|
|
||||||
- récriture doc -> TODO
|
- récriture doc -> TODO
|
||||||
- créer une section Showcase
|
- créer une section Showcase
|
||||||
- refaire la possibilité d'overrider le style/script/etc -> TODO
|
|
||||||
- créer des jolis thèmes de base (avec des noms) -> TODO
|
- créer des jolis thèmes de base (avec des noms) -> TODO
|
||||||
- ajouter les attachments -> TODO
|
- ajouter les attachments -> TODO
|
||||||
|
- ajouter les childs -> TODO
|
||||||
|
|
||||||
|
- refaire la possibilité d'overrider le style/script/etc -> OK
|
||||||
|
- sticky bar -> OK
|
||||||
- ajouter Travis pour tester le thème quotidiennement avec les nouvelles versions de Hugo -> OK
|
- ajouter Travis pour tester le thème quotidiennement avec les nouvelles versions de Hugo -> OK
|
||||||
- #54 -> OK
|
- #54 -> OK
|
||||||
- corriger slider menu qui ne fonctionne plus -> OK
|
- corriger slider menu qui ne fonctionne plus -> OK
|
||||||
|
|
BIN
exampleSite/content/cont/shortcodes.files/BachGavotteShort.mp3
Normal file
BIN
exampleSite/content/cont/shortcodes.files/BachGavotteShort.mp3
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
exampleSite/content/cont/shortcodes.files/hugo.png
Normal file
BIN
exampleSite/content/cont/shortcodes.files/hugo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
@ -12,6 +12,14 @@ To avoid this limitations, Hugo created [shortcodes](https://gohugo.io/extras/sh
|
||||||
|
|
||||||
**Hugo-theme-learn** provides multiple shortcodes on top of existing ones.
|
**Hugo-theme-learn** provides multiple shortcodes on top of existing ones.
|
||||||
|
|
||||||
|
## Attachments
|
||||||
|
|
||||||
|
{{% attachments style="info" /%}}
|
||||||
|
{{% attachments style="warning" /%}}
|
||||||
|
{{% attachments style="note" /%}}
|
||||||
|
{{% attachments style="tip" /%}}
|
||||||
|
{{% attachments /%}}
|
||||||
|
|
||||||
## Notice
|
## Notice
|
||||||
|
|
||||||
The notice shortcode shows 4 types of disclaimers to help you structure your page.
|
The notice shortcode shows 4 types of disclaimers to help you structure your page.
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8"> {{ partial "meta.html" . }} {{ partial "favicon.html" . }} {{ .Scratch.Add "title" "" }}{{ if eq .Site.Data.titles .Title }}{{ .Scratch.Set "title" (index .Site.Data.titles .Title).title }}{{ else }}{{ .Scratch.Set "title" .Title}}{{end}}
|
<meta charset="utf-8"> {{ partial "meta.html" . }} {{ partial "favicon.html" . }} {{ .Scratch.Add "title" "" }}{{ if eq .Site.Data.titles .Title }}{{ .Scratch.Set "title" (index .Site.Data.titles .Title).title }}{{ else }}{{ .Scratch.Set "title" .Title}}{{end}}
|
||||||
<title>{{ .Scratch.Get "title" }}</title>
|
<title>{{ .Scratch.Get "title" }}</title>
|
||||||
{{ partial "style.html" . }}
|
|
||||||
|
|
||||||
<link href="{{"css/nucleus.css" | relLangURL}}{{ if not .Site.Params.disableAssetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
<link href="{{"css/nucleus.css" | relLangURL}}{{ if not .Site.Params.disableAssetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
||||||
<link href="{{"css/font-awesome.min.css" | relLangURL}}{{ if not .Site.Params.disableAssetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
<link href="{{"css/font-awesome.min.css" | relLangURL}}{{ if not .Site.Params.disableAssetBusting }}?{{ now.Unix }}{{ end }}" rel="stylesheet">
|
||||||
|
@ -27,7 +26,8 @@
|
||||||
ul {
|
ul {
|
||||||
list-style-type: none;
|
list-style-type: none;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
{{ partial "custom-header.html" . }}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
1
layouts/partials/custom-footer.html
Normal file
1
layouts/partials/custom-footer.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<!-- Partial intended to be overwritten with tags loaded at the end of the page loading (usually for Javascript) -->
|
1
layouts/partials/custom-header.html
Normal file
1
layouts/partials/custom-header.html
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<!-- Partial intended to be overwritten to add custom headers, like CSS or any other info -->
|
|
@ -69,5 +69,8 @@
|
||||||
<script>
|
<script>
|
||||||
mermaid.initialize({ startOnLoad: true });
|
mermaid.initialize({ startOnLoad: true });
|
||||||
</script>
|
</script>
|
||||||
|
<script>
|
||||||
|
{{ partial "custom-footer.html" . }}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
}
|
}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
</style>
|
</style>
|
||||||
{{ partial "style.html" . }}
|
{{ partial "custom-header.html" . }}
|
||||||
</head>
|
</head>
|
||||||
<body class="" data-url="{{ .RelPermalink }}">
|
<body class="" data-url="{{ .RelPermalink }}">
|
||||||
{{ partial "menu.html" . }}
|
{{ partial "menu.html" . }}
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
<!-- Partial intended to be overwritten to add javacript -->
|
|
|
@ -1 +0,0 @@
|
||||||
<!-- Partial intended to be overwritten to add CSS -->
|
|
|
@ -1,6 +1,6 @@
|
||||||
<section class="attachments">
|
<section class="attachments {{ with .Get "style"}}{{.}}{{ end }}">
|
||||||
<label>
|
<label>
|
||||||
<span class="glyphicon glyphicon-paperclip" aria-hidden="true"></span>
|
<i class="fa fa-paperclip" aria-hidden="true"></i>
|
||||||
{{with .Get "title"}}{{.}}{{else}}{{T "Attachments-label"}}{{end}}
|
{{with .Get "title"}}{{.}}{{else}}{{T "Attachments-label"}}{{end}}
|
||||||
</label>
|
</label>
|
||||||
{{if eq .Page.File.BaseFileName "index"}}
|
{{if eq .Page.File.BaseFileName "index"}}
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
{{else}}
|
{{else}}
|
||||||
{{$.Scratch.Add "filesName" (printf "%s.files" .Page.File.BaseFileName)}}
|
{{$.Scratch.Add "filesName" (printf "%s.files" .Page.File.BaseFileName)}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<div class="attachments-files">
|
||||||
{{ range (readDir (printf "./content/%s%s" .Page.File.Dir ($.Scratch.Get "filesName")) ) }}
|
{{ range (readDir (printf "./content/%s%s" .Page.File.Dir ($.Scratch.Get "filesName")) ) }}
|
||||||
{{ $fileDir := replace $.Page.File.Dir "\\" "/" }}
|
{{ $fileDir := replace $.Page.File.Dir "\\" "/" }}
|
||||||
{{if ($.Get "pattern")}}
|
{{if ($.Get "pattern")}}
|
||||||
|
@ -28,6 +29,7 @@
|
||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
<div>
|
||||||
|
{{.Inner}}
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
{{.Inner}}
|
|
|
@ -529,6 +529,65 @@ div.notices.tip p {
|
||||||
div.notices.tip p:first-child:after {
|
div.notices.tip p:first-child:after {
|
||||||
content: 'Tip';
|
content: 'Tip';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
section.attachments {
|
||||||
|
margin: 2rem 0;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments label {
|
||||||
|
font-weight: 400;
|
||||||
|
padding-left: 0.5em;
|
||||||
|
padding-top: 0.2em;
|
||||||
|
padding-bottom: 0.2em;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments .attachments-files {
|
||||||
|
padding: 15px;
|
||||||
|
display: block;
|
||||||
|
font-size: 1rem;
|
||||||
|
margin-top: 0rem;
|
||||||
|
margin-bottom: 0rem;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments.info label {
|
||||||
|
color: #fff;
|
||||||
|
background: #F0B37E;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments.info .attachments-files {
|
||||||
|
background: #FFF2DB;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments.tip label {
|
||||||
|
color: #fff;
|
||||||
|
background: rgba(92, 184, 92, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments.tip .attachments-files {
|
||||||
|
background: #E6F9E6;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments.warning label {
|
||||||
|
color: #fff;
|
||||||
|
background: rgba(217, 83, 79, 0.8);
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments.warning .attachments-files {
|
||||||
|
background: #FAE2E2;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments.note label {
|
||||||
|
color: #fff;
|
||||||
|
background: #6AB0DE;
|
||||||
|
}
|
||||||
|
|
||||||
|
section.attachments.note .attachments-files {
|
||||||
|
background: #E7F2FA;
|
||||||
|
}
|
||||||
|
|
||||||
code, kbd, pre, samp {
|
code, kbd, pre, samp {
|
||||||
font-family: "Consolas", menlo, monospace;
|
font-family: "Consolas", menlo, monospace;
|
||||||
font-size: 92%;
|
font-size: 92%;
|
||||||
|
|
Loading…
Reference in a new issue