mirror of
https://github.com/amehime/hexo-theme-shoka.git
synced 2026-04-05 02:16:56 +08:00
fix
This commit is contained in:
23
layout/_macro/widget.njk
Normal file
23
layout/_macro/widget.njk
Normal file
@@ -0,0 +1,23 @@
|
||||
{% macro render() %}
|
||||
<div class="widgets">
|
||||
<div class="rpost pjax">
|
||||
<h2>{{__('index.random_posts')}}</h2>
|
||||
<ul>
|
||||
{%- set posts = site.posts.shuffle().limit(10).toArray() %}
|
||||
{%- for item in posts %}
|
||||
{%- if item.link %}
|
||||
{%- set postTitleIcon = '<i class="ic i-link-alt"></i>' %}
|
||||
{%- endif %}
|
||||
<li class="item">
|
||||
{{ breadcrumb.render(item, false) }}
|
||||
{%- set postText = item.title or item.link or __('post.untitled') %}
|
||||
<span>{{ _url(item.link or item.path, postText + (postTitleIcon or ''), {title: postText}) }}</span>
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div id="rcomment">
|
||||
<h2>{{__('index.recent_comments')}}</h2>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}
|
||||
@@ -1,5 +1,5 @@
|
||||
{% import '_macro/sidebar.njk' as sidebar with context %}
|
||||
{% import '_macro/breadcrumb.njk' as breadcrumb with context %}
|
||||
{% import '_macro/widget.njk' as widget with context %}
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ config.language }}">
|
||||
@@ -84,27 +84,7 @@
|
||||
</main>
|
||||
<footer id="footer">
|
||||
<div class="inner">
|
||||
<div class="widgets">
|
||||
<div class="rpost pjax">
|
||||
<h2>{{__('index.random_posts')}}</h2>
|
||||
<ul>
|
||||
{%- set posts = site.posts.shuffle().limit(10).toArray() %}
|
||||
{%- for item in posts %}
|
||||
{%- if item.link %}
|
||||
{%- set postTitleIcon = '<i class="ic i-link-alt"></i>' %}
|
||||
{%- endif %}
|
||||
<li class="item">
|
||||
{{ breadcrumb.render(item, false) }}
|
||||
{%- set postText = item.title or item.link or __('post.untitled') %}
|
||||
<span>{{ _url(item.link or item.path, postText + (postTitleIcon or ''), {title: postText}) }}</span>
|
||||
</li>
|
||||
{%- endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
<div id="rcomment">
|
||||
<h2>{{__('index.recent_comments')}}</h2>
|
||||
</div>
|
||||
</div>
|
||||
{{ widget.render() }}
|
||||
{{ partial('_partials/footer.njk', {}, {cache: true}) }}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
Reference in New Issue
Block a user