Skip to content

Commit

Permalink
Merge pull request #2 from reorx/master
Browse files Browse the repository at this point in the history
Sync with upstream reorx/hugo-PaperModx:master
  • Loading branch information
Triple-Z authored Jan 23, 2023
2 parents f867ba3 + 08aad53 commit c56c7cb
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 19 deletions.
65 changes: 49 additions & 16 deletions assets/css/extended/newsletter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ body.type-newsletter {
--signature: #CB3A56;
--signature-bg: rgba(203, 58, 87, 0.239);
--signature-bg-dim: rgba(203, 58, 87, 0.147);
--signature-bg-dimmer: rgba(203, 58, 87, 0.084);
--main-border: 5px solid var(--signature);
--icon-length: 50px;
--icon-font-size: 32px;
Expand Down Expand Up @@ -43,19 +44,27 @@ body.type-newsletter {
}

/* shared */
.sub-form {
display: flex;
flex-direction: column;
margin: calc(var(--content-gap) * 1.5) 0;
.subscribe-form {
margin: calc(var(--content-gap) * 2) 0;

form {
display: flex;
flex-direction: column;
line-height: 1.2em;
flex-wrap: wrap;
}
input {
.input-group {
display: flex;
flex-wrap: wrap;
}
.subscribe-option {
margin-top: 8px;
}
input[type=text] {
border: 3px solid var(--signature-bg-dim);
color: var(--secondary);
border-radius: 0px;
border-color: var(--signature-bg);
appearance: none;
outline: none;
background-color: var(--theme);
Expand All @@ -76,13 +85,40 @@ body.type-newsletter {
margin-left: var(--content-gap);
white-space: nowrap;
}
label, .label {
font-size: .85em;
margin-right: 16px;
}
.label {
color: var(--secondary);
line-height: 1.2;
}
input[type=radio] {
margin-left: 0;
margin-top: 0;
}
}

@media screen and (max-width: $small) {
.sub-form {
.subscribe-form {
font-size: .9em;
input[type=text] {
padding-left: 8px;
padding-right: 8px;
}
button {
width: 96px;
margin-left: 0;
margin-top: calc(var(--content-gap)/2);
flex-grow: 1;
padding-left: 0;
padding-right: 0;
}
.hide-for-sm {
display: none;
}
.label {
display: block;
width: 100%;
margin-bottom: 4px;
}
}
}
Expand Down Expand Up @@ -284,18 +320,15 @@ body.type-newsletter.kind-page {

.newsletter-sub {
margin-top: calc(var(--content-gap) * 1.5);
background-color: var(--signature-bg-dim);
padding: 1em;
background-color: var(--signature-bg-dimmer);
padding: var(--content-gap) var(--gap);
.notice {
font-size: .8em;
font-size: .9em;
color: var(--signature);
line-height: 1.6;
}
.sub-form {
margin: 1em 0;
input {
border-color: var(--signature-bg);
}
.subscribe-form {
margin: var(--content-gap) 0 0;
}
}
}
3 changes: 2 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ <h1 class="post-title">
{{- if $isNewsletter }}
<div class="newsletter-sub">
<div class="notice">
感谢你能读到这里,如果觉得有趣的话,欢迎在下方输入邮箱进行订阅。
<div style="font-weight: bold">Thanks for reading, if you like it, please subscribe below.</div>
<div style="font-size: .85em; margin-top: 8px;">感谢你能读到这里,如果觉得有趣的话,欢迎在下方输入邮箱进行订阅。</div>
</div>
{{- partial "newsletter_sub_form.html"}}
</div>
Expand Down
24 changes: 24 additions & 0 deletions layouts/_default/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
{{ range .Data.Pages }}
{{- if and (not .Params.nositemap) .Permalink -}}
<url>
<loc>{{ .Permalink }}</loc>{{ if not .Lastmod.IsZero }}
<lastmod>{{ safeHTML ( .Lastmod.Format "2006-01-02T15:04:05-07:00" ) }}</lastmod>{{ end }}{{ with .Sitemap.ChangeFreq }}
<changefreq>{{ . }}</changefreq>{{ end }}{{ if ge .Sitemap.Priority 0.0 }}
<priority>{{ .Sitemap.Priority }}</priority>{{ end }}{{ if .IsTranslated }}{{ range .Translations }}
<xhtml:link
rel="alternate"
hreflang="{{ .Language.Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
<xhtml:link
rel="alternate"
hreflang="{{ .Language.Lang }}"
href="{{ .Permalink }}"
/>{{ end }}
</url>
{{- end -}}
{{ end }}
</urlset>
4 changes: 2 additions & 2 deletions layouts/partials/newsletter_sub_form.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{/* Add `layouts/partials/newsletter_sub_form.html` in your own code to customize the form */}}

<div class="sub-form">
<div class="subscribe-form">
<form action="">
<input type="text" name="email" placeholder="Your email address">
<button>订阅 | Subscribe</button>
<button>Subscribe | 订阅</button>
</form>
</div>

0 comments on commit c56c7cb

Please sign in to comment.