initial commit
This commit is contained in:
parent
2012aa8834
commit
9ddfa58ace
2289 changed files with 11217 additions and 0 deletions
64
themes/hugo-ficurinia/layouts/partials/js_paginator.html
Normal file
64
themes/hugo-ficurinia/layouts/partials/js_paginator.html
Normal file
|
@ -0,0 +1,64 @@
|
|||
<script>
|
||||
const tagsStr = '{{ i18n "tags" | safeJS }}'
|
||||
|
||||
function renderTags(tags) {
|
||||
if (tags.length <= 0) return '';
|
||||
let res = `| <span title=''> </span>`;
|
||||
for (let tag of tags) {
|
||||
// regular space
|
||||
res += `<a href="/tags/${tag}/">#${tag}</a> `;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
function renderImage(image, link, alt) {
|
||||
if (!image) return '';
|
||||
return `<a href="${link}"><img src="${image}" alt="${alt}" /></a>`;
|
||||
}
|
||||
function renderSingleArticle(article) {
|
||||
{{ if (.Site.Params.tagsInArticlePreview | default true) }}
|
||||
const tags = renderTags(article.tags)
|
||||
{{ else }}
|
||||
const tags = ''
|
||||
{{ end }}
|
||||
|
||||
{{ if .Site.Params.imageInArticlePreview }}
|
||||
const img = renderImage(article.image, article.link, article.imageAlt)
|
||||
{{ else }}
|
||||
const img = ''
|
||||
{{ end }}
|
||||
|
||||
{{ if (site.Params.articleSummary | default true) }}
|
||||
const continueReadingStr = '{{ i18n "continueReading" | safeJS }}'
|
||||
const summ = `<div class="articlePreview">
|
||||
<p>${article.summary}</p>
|
||||
<p><a href="${article.link}">${continueReadingStr} </a></p>
|
||||
</div>`
|
||||
{{ else }}
|
||||
const summ = ''
|
||||
{{ end }}
|
||||
|
||||
const dateStr = '{{ i18n "date" | safeJS }}'
|
||||
|
||||
return `
|
||||
<article class="card postlistitem">
|
||||
<div>
|
||||
<h2>
|
||||
<a href="${article.link}">${article.title}</a>
|
||||
</h2>
|
||||
<p class="date">
|
||||
<span title='${dateStr}'> </span>
|
||||
${article.date}
|
||||
${tags}
|
||||
</p>
|
||||
${img}
|
||||
${summ}
|
||||
</div>
|
||||
<hr />
|
||||
</article>
|
||||
`;
|
||||
}
|
||||
function renderArticles(articles) {
|
||||
let rendered = articles.map(a => renderSingleArticle(a)).join('\n');
|
||||
document.getElementById('postlist').innerHTML += rendered;
|
||||
}
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue