gallery bug fix, link feed

This commit is contained in:
zzossig 2019-11-22 16:29:07 +09:00
parent 061d7c1e80
commit 4b94f7fac2
5 changed files with 9 additions and 47 deletions

View File

@ -6,8 +6,8 @@
</div>
</header>
{{ $root := . }}
{{ if in (lower .Params.Mode) "one" }}
<main class="gallery main">
<div class="grid single__contents single__contents--gallery">
<div class="grid-sizer"></div>
@ -15,7 +15,7 @@
{{ $basename := (replace .File.Dir "\\" "/") }}
{{ range .Params.Images }}
<div class="grid-item">
<a data-alt="{{ print .caption }}" data-fancybox="gallery" href="{{ $basename | relURL }}{{ .image }}"><img src="{{ $basename | relURL }}{{ .image }}" alt="{{ print .caption }}"/></a>
<a data-fancybox="gallery" href="{{ $basename | relURL }}{{ .image }}" data-alt="{{ print .caption }}"><img src="{{ $basename | relURL }}{{ .image }}" alt="{{ print .caption }}"/></a>
<div class="grid-item__desc hide">{{ .caption }}</div>
</div>
{{ end }}
@ -33,7 +33,7 @@
{{ $basename := (replace .File.Dir "\\" "/") }}
{{ range (readDir (print "./static/" $basename)) }}
<div class="grid-item">
<a data-alt="{{ index (split .Name ".") 0 }}" data-fancybox="gallery" href="{{ $basename | relURL }}{{ .Name }}"><img src="{{ $basename | relURL }}{{ .Name }}" alt="{{ index (split .Name ".") 0 }}"/></a>
<a data-fancybox="gallery" href="{{ $basename | relURL }}{{ .Name }}" data-alt="{{ index (split .Name ".") 0 }}"><img src="{{ $basename | relURL }}{{ .Name }}" alt="{{ index (split .Name ".") 0 }}"/></a>
<div class="grid-item__desc hide">{{ index (split .Name ".") 0 }}</div>
</div>
{{ end }}

View File

@ -24,10 +24,10 @@
}
});
var imgElements = $('.single__contents:not(".single__contents--gallery")').find('img');
imgElements.each(function(i, v) {
var imgElements = $('.single__contents:not(".single__contents--gallery")').find('img');
imgElements.each(function(i, v) {
$(this).css('cursor', 'pointer');
$(this).wrap(`<a data-fancybox="gallery" href="${ $(this).attr('src') }" alt="${ $(this).attr('alt') }" data-caption="${ $(this).attr('alt') }"></a>`);
$(this).wrap(`<a data-fancybox="gallery" href="${ $(this).attr('src') }" data-alt="${ $(this).attr('alt') }" data-caption="${ $(this).attr('alt') }"></a>`);
});
});
</script>

View File

@ -1,27 +0,0 @@
{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
<description>Recent content {{ if ne .Title .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
<generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
<language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
<managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
<webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
<copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
<lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
{{ with .OutputFormats.Get "RSS" }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range .Pages }}
<item>
<title>{{ .Title }}</title>
<link>{{ .Permalink }}</link>
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
<guid>{{ .Permalink }}</guid>
<description>{{ .Summary | html }}</description>
</item>
{{ end }}
</channel>
</rss>

View File

@ -1,11 +1,5 @@
{{ if $.Param "showFeedLinks" }}
{{ if .Site.LanguagePrefix -}}
<a href="{{ .Site.LanguagePrefix | absURL }}/index.xml" type="application/rss+xml" title="rss">
<a href="{{ "/" | relLangURL }}/index.xml" type="application/rss+xml" title="rss">
{{ partial "svgs/etc/rss.svg" (dict "width" 32 "height" 32) }}
</a>
{{ else }}
<a href="{{ .Site.RSSLink }}" type="application/rss+xml" title="rss">
{{ partial "svgs/etc/rss.svg" (dict "width" 32 "height" 32) }}
</a>
{{ end }}
{{ end }}

View File

@ -30,16 +30,11 @@
{{ end }}
<script>
{{ if .Site.IsMultiLingual }}
var baseurl = "{{.Site.BaseURL}}{{.Site.LanguagePrefix}}";
{{ else }}
var baseurl = "{{.Site.BaseURL}}";
{{ end }}
$(document).ready(function () {
{{ $searchLanguages := .Site.Params.searchLanguages }}
var searchLanguages = JSON.parse({{ $searchLanguages | jsonify }});
var baseurl = "{{ "/" | relLangURL }}";
if (!searchLanguages) {
searchLanguages = ['en'];
}