Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
wangbinyq committed Oct 10, 2022
1 parent bb1b2fa commit e93ce94
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 104 deletions.
3 changes: 1 addition & 2 deletions src/_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,4 @@ mergedKeys:
theme:
fancy: true
disqus_shortname: 285210
more_link: true
paginate_size: 2
more_link: true
45 changes: 5 additions & 40 deletions src/_includes/layouts/archive.njk
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,17 @@
layout: layouts/base.njk
bodyClass: body-tag
---
<header class="page-header">
<h1 class="page-title">{{ title }}</h1>

<p>
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http:https://www.w3.org/2000/svg"><circle cx="3" cy="13" r="2" fill="currentColor"/><path d="M14 13C14 6.925 9.075 2 3 2M9 13a6 6 0 0 0-6-6" stroke="currentColor" stroke-width="2" stroke-linecap="round"/></svg> RSS:
<a href="/feed.xml">Atom</a>, <a href="/feed.json">JSON</a>
</p>

{% if pagination.page == 1 %}
<div class="search" id="search"></div>
{% endif %}
</header>

{% if pagination.page == 1 %}
<nav class="page-navigation">
<h2>Tags:</h2>

<ul class="page-navigation-tags">
{% for page in search.pages("type=tag", "tag") %}
<li><a href="{{ page.data.url }}" class="tag">{{ page.data.tag }}</a></li>
{% endfor %}
</ul>
</nav>
{% endif %}

{% set postslist = results %}
{% include "templates/post-list.njk" %}

{% if pagination.totalPages != 1 %}
<nav class="page-pagination">
<ul>
<nav id="page-nav">
{%- if pagination.previous %}
<li>
<a href="{{ pagination.previous }}" rel="prev">← Previous</a>
</li>
<a class="extend next" href="{{ pagination.previous }}" rel="prev">« 上一页</a>
{% endif %}

<li>
Page {{ pagination.page }}
</li>

{%- if pagination.next %}
<li>
<a href="{{ pagination.next }}" rel="next">Next →</a>
</li>
<a class="extend next" href="{{ pagination.next }}" rel="next">下一页 »</a>
{% endif %}
</ul>
</nav>
{% endif %}
</nav>
{% endif %}
3 changes: 1 addition & 2 deletions src/_includes/layouts/archive_result.njk
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ layout: layouts/base.njk
bodyClass: body-tag
---
<header class="page-header">
<p><a href="/archive/">← Back</a></p>
<h1 class="page-title">{{ title }}</h1>
</header>

{% set postslist = search.pages(search_query) %}
{% include "templates/post-list.njk" %}
{% include "templates/post-list.njk" %}
8 changes: 3 additions & 5 deletions src/_includes/layouts/base.njk
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@
<li>
<a id="nav-search-btn" class="nav-icon" title="<%- __('index.search') %>"></a>
</li>
<% if (theme.rss) { %>
<li>
<a href="<%- theme.rss %>" id="nav-rss-link" class="nav-icon" title="<%- __('index.feed') %>"></a>
</li>
<% } %>
<li>
<a href="/feed.xml" id="nav-rss-link" class="nav-icon" title="RSS 订阅"></a>
</li>
</ul>
</nav>
<div id="search-form-wrap">
Expand Down
6 changes: 3 additions & 3 deletions src/_includes/templates/post-details.njk
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<span class="meta-elements author">{{ autor or site.author?.name }}</span>
<div class="commentscount">
{% if theme.disqus_shortname %}
<a href="{{ post.url | url(true) }}#disqus_thread" class="article-comment-link">评论</a>
<a href="{{ post.url | url(true) }}#disqus_thread" class="article-comment-link">Comments</a>
{% endif %}
</div>
</header>
Expand Down Expand Up @@ -75,15 +75,15 @@
<nav id="article-nav">
{% if previousPost %}
<a href="{{previousPost.data.url}}" id="article-nav-newer" class="article-nav-link-wrap" rel="prev">
<strong class="article-nav-caption">« 上一篇</strong>
<strong class="article-nav-caption">上一篇</strong>
<div class="article-nav-title">
{{ previousPost.data.title }}
</div>
</a>
{% endif %}
{% if nextPost %}
<a href="{{nextPost.data.url}}" id="article-nav-older" class="article-nav-link-wrap" rel="next">
<strong class="article-nav-caption">下一篇 »</strong>
<strong class="article-nav-caption">下一篇</strong>
<div class="article-nav-title">
{{ nextPost.data.title }}
</div>
Expand Down
6 changes: 0 additions & 6 deletions src/_includes/templates/post-list.njk
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
<ul class="postList">
{% asyncEach post in postslist %}
<li class="post">
<h2 class="post-title">
<a href="{{ post.data.url }}" {% if post.data.url == url %} aria-current="page"{% endif %}>
{{ post.data.title or post.data.url }}
</a>
</h2>

{% set date = post.data.date %}
{% set tags = post.data.tags %}
{% set author = post.data.author %}
Expand Down
6 changes: 2 additions & 4 deletions src/archive.tmpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ export const title = "Archive";
export default function* ({ search, paginate, theme }) {
const posts = search.pages("type=post", "date=desc");

console.log(theme?.paginate_size)

for (
const data of paginate(posts, { url, size: theme?.paginate_size || 10 })
const data of paginate(posts, { url, size: theme?.paginate_size || 20 })
) {
// Show the first page in the menu
if (data.pagination.page === 1) {
Expand All @@ -23,7 +21,7 @@ export default function* ({ search, paginate, theme }) {

function url(n) {
if (n === 1) {
return "/archive/";
return "/";
}

return `/archive/${n}/`;
Expand Down
42 changes: 0 additions & 42 deletions src/index.njk

This file was deleted.

33 changes: 33 additions & 0 deletions src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -1177,3 +1177,36 @@ pre .deletion {
margin-bottom: 1em;
}
}


:root {
/* Fonts */
--font-family-code: Consolas, Menlo, Monaco, "Andale Mono WT", "Andale Mono", "Lucida Console", "Lucida Sans Typewriter", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Liberation Mono", "Nimbus Mono L", "Courier New", Courier, monospace;
--font-family-ui: -apple-system, system-ui, sans-serif;

--font-code: 1rem/1.5 var(--font-family-code);
--font-display: bold clamp(2rem, 10vw, 4rem)/1 var(--font-family-ui);
--font-display-spacing: -0.02em;
--font-title: bold clamp(1.5rem, 8vw, 2rem)/1.2 var(--font-family-ui);
--font-title-spacing: -0.015em;
--font-body: clamp(1rem, 5vw, 1.2rem)/1.5 var(--font-family-ui);
--font-body-bold: bold var(--font-body);
--font-body-spacing: 0;
--font-ui: 1rem/1.4 var(--font-family-ui);
--font-small: 0.85rem/1.4 var(--font-family-ui);

/* Space */
--row-gap-xsmall: 1rem;
--row-gap-small: 2.5rem;
--row-gap-medium: 5rem;
}

.page-title {
font: var(--font-display);
letter-spacing: var(--font-display-spacing);
margin: 0;
}

.page-header {
margin-bottom: var(--row-gap-medium);
}

0 comments on commit e93ce94

Please sign in to comment.