mirror of https://github.com/jlelse/GoBlog
Add option to add announcement to blog header
This commit is contained in:
parent
79f807e01a
commit
67152c7079
|
@ -76,6 +76,7 @@ type configBlog struct {
|
|||
Comments *configComments `mapstructure:"comments"`
|
||||
Map *configGeoMap `mapstructure:"map"`
|
||||
Contact *configContact `mapstructure:"contact"`
|
||||
Announcement *configAnnouncement `mapstructure:"announcement"`
|
||||
}
|
||||
|
||||
type configSection struct {
|
||||
|
@ -170,6 +171,10 @@ type configContact struct {
|
|||
EmailTo string `mapstructure:"emailTo"`
|
||||
}
|
||||
|
||||
type configAnnouncement struct {
|
||||
Text string `mapstructure:"text"`
|
||||
}
|
||||
|
||||
type configUser struct {
|
||||
Nick string `mapstructure:"nick"`
|
||||
Name string `mapstructure:"name"`
|
||||
|
|
|
@ -235,4 +235,7 @@ blogs:
|
|||
smtpUser: mail@example.com # SMTP user
|
||||
smtpPassword: secret # SMTP password
|
||||
emailFrom: blog@example.com # Email sender
|
||||
emailTo: mail@example.com # Email recipient
|
||||
emailTo: mail@example.com # Email recipient
|
||||
# Announcement
|
||||
announcement:
|
||||
text: This is an **announcement**! # Can be markdown with links etc.
|
|
@ -137,13 +137,7 @@ pre {
|
|||
|
||||
mark, :not(pre) > code {
|
||||
font-size: 1rem;
|
||||
// Invert
|
||||
@include color(color, background);
|
||||
@include color(background, primary);
|
||||
&::selection {
|
||||
@include color(color, primary);
|
||||
@include color(background, background);
|
||||
}
|
||||
@extend .invert;
|
||||
}
|
||||
|
||||
code {
|
||||
|
@ -234,6 +228,15 @@ details summary {
|
|||
transition: transform 2s ease;
|
||||
}
|
||||
|
||||
.invert {
|
||||
@include color(color, background);
|
||||
@include color(background, primary);
|
||||
&::selection {
|
||||
@include color(color, primary);
|
||||
@include color(background, background);
|
||||
}
|
||||
}
|
||||
|
||||
#map {
|
||||
height: 400px;
|
||||
}
|
||||
|
@ -249,6 +252,16 @@ details summary {
|
|||
}
|
||||
}
|
||||
|
||||
#announcement {
|
||||
@extend .invert;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
* {
|
||||
@extend .invert;
|
||||
}
|
||||
}
|
||||
|
||||
// Print
|
||||
@media print {
|
||||
html {
|
||||
|
@ -266,7 +279,8 @@ details summary {
|
|||
#related,
|
||||
#interactions,
|
||||
#posteditactions,
|
||||
#tor {
|
||||
#tor,
|
||||
#announcement {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -94,16 +94,6 @@ pre {
|
|||
|
||||
mark, :not(pre) > code {
|
||||
font-size: 1rem;
|
||||
color: #fff;
|
||||
color: var(--background, #fff);
|
||||
background: #000;
|
||||
background: var(--primary, #000);
|
||||
}
|
||||
mark::selection, :not(pre) > code::selection {
|
||||
color: #000;
|
||||
color: var(--primary, #000);
|
||||
background: #fff;
|
||||
background: var(--background, #fff);
|
||||
}
|
||||
|
||||
code {
|
||||
|
@ -191,6 +181,19 @@ details summary > *:first-child {
|
|||
transition: transform 2s ease;
|
||||
}
|
||||
|
||||
.invert, #announcement *, #announcement, mark, :not(pre) > code {
|
||||
color: #fff;
|
||||
color: var(--background, #fff);
|
||||
background: #000;
|
||||
background: var(--primary, #000);
|
||||
}
|
||||
.invert::selection, #announcement ::selection, #announcement::selection, mark::selection, :not(pre) > code::selection {
|
||||
color: #000;
|
||||
color: var(--primary, #000);
|
||||
background: #fff;
|
||||
background: var(--background, #fff);
|
||||
}
|
||||
|
||||
#map {
|
||||
height: 400px;
|
||||
}
|
||||
|
@ -204,6 +207,11 @@ details summary > *:first-child {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
#announcement {
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
@media print {
|
||||
html {
|
||||
--background: #fff;
|
||||
|
@ -222,7 +230,8 @@ details summary > *:first-child {
|
|||
#related,
|
||||
#interactions,
|
||||
#posteditactions,
|
||||
#tor {
|
||||
#tor,
|
||||
#announcement {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,9 @@
|
|||
{{ define "header" }}
|
||||
{{ with .Blog.Announcement }}{{ with .Text }}
|
||||
<div id="announcement" data-nosnippet>
|
||||
{{ md . }}
|
||||
</div>
|
||||
{{ end }}{{ end }}
|
||||
<header>
|
||||
<h1><a href="{{ .Blog.RelativePath "/" }}" rel="home" title="{{ mdtitle .Blog.Title }}" translate="no">{{ mdtitle .Blog.Title }}</a></h1>
|
||||
{{ with .Blog.Description }}<p><i>{{ . }}</i></p>{{ end }}
|
||||
|
|
Loading…
Reference in New Issue