惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
博客园 - 聂微东
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
GbyAI
GbyAI
WordPress大学
WordPress大学
NISL@THU
NISL@THU
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
D
DataBreaches.Net
F
Full Disclosure
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V
Visual Studio Blog
Last Week in AI
Last Week in AI
L
LangChain Blog
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
V
V2EX
The Hacker News
The Hacker News
Scott Helme
Scott Helme
T
Troy Hunt's Blog
G
GRAHAM CLULEY
L
Lohrmann on Cybersecurity
Cloudbric
Cloudbric
C
Cyber Attacks, Cyber Crime and Cyber Security
O
OpenAI News
月光博客
月光博客
博客园_首页
Blog — PlanetScale
Blog — PlanetScale
B
Blog RSS Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
G
Google Developers Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
IT之家
IT之家
C
Cisco Blogs
Google DeepMind News
Google DeepMind News
T
Tenable Blog
Jina AI
Jina AI
T
Tor Project blog
The Cloudflare Blog
Y
Y Combinator Blog
Spread Privacy
Spread Privacy
L
LINUX DO - 热门话题
Cyberwarzone
Cyberwarzone
Microsoft Security Blog
Microsoft Security Blog
Stack Overflow Blog
Stack Overflow Blog
A
Arctic Wolf

Jekyll

Installing Jekyll on macOS Ventura 在 macOS Big Sur / Monterey 上适用的 Jekyll 安装过程 - V2EX 这可能是 2022 年最方便快捷的搭建个人博客的教程了--github pages+Jekyll 三步搞定无需命令行无需配环境 - V2EX 想把博客从 hexo 迁移到 Jekyll 了 - V2EX 一种让 Jekyll 使用 WebP 图片的实现方案 - V2EX 学习 Jekyll 日志贴 - V2EX 自荐一款自己写的 Jekyll 主题 - V2EX 分享一个不错的 jekyll 主题集合站 - V2EX Jekyll 博客换行问题 - V2EX docs.docker.com 用的 jekyll 主题能剥出来用吗? - V2EX 分享一套原创 Jekyll 主题: Project Gaia - V2EX jekyll 天坑啊. 一篇文章 5.6M .. 650 篇文章.. 就是 3.79G 啊 . 难怪本地生成用了 46 分钟啊.. - V2EX 大家有没有遇到过本地预览经常忽略新建的文档? - V2EX jekyll serve 一直过不了关 - V2EX jekyll 怎么添加一个主题 skinny-bones-jekyll? - V2EX 请教: jekyl 博客上传设置问题 - V2EX jekyll 主题汇总站 - V2EX 开始改用新的主题! - V2EX Jekyll 静态页面 md 格式怎么没有解析 - V2EX 来发一些你们自己原创的 Jekyll 主题吧 - V2EX Jekyll 的 markdown 解析真是蛋疼啊 - V2EX 分享一个 Jekyll 框架: Almace Scaffolding - V2EX 上次吐槽 Jekyll 纯静态,现在博客却已经由 Wordpress 迁移到 Jekyll,你们会骂我么? - V2EX Jekyll 输出特定栏目文章列表的方法 - V2EX jekyll 本地启动的问题 - V2EX 刚刚又剁手买了 JekyllWriter.com 这个域名,我没救了 - V2EX gitbook 生成的静态页面有错误,和 jekyll 有关么? - V2EX Jekyll 3.0 Released - V2EX 怎么替换 jekyll 的 markdown 渲染引擎呢? - V2EX Jekyll 以#为注释,那要怎么输出 RGB 颜色? - V2EX jekyll 解析 excel 或 cvs - V2EX Hexo 和 Jekyll 的主要差异是什么,各自的优缺点是什么? - V2EX Jekyll 搭建的博客,大家一般把图放在什么地方呢? - V2EX 2015 年新年知识点! 快速搭建 jekyll by jekyllnow - V2EX 如何才能将 Jekyll 部署在子目? - V2EX 推荐两款很好地 jekyll 主题,在 github 写博客吧 - V2EX 分享一个 Jekyll 主题 - V2EX jekyll 上传到 github 页面错乱八七,没有样式 - V2EX Jekyll 和 Jekyll-bootstrap 有什么区别?能否互通? - V2EX 运行在 GitHub 上的 Jekyll 博客怎么样能够添加文章分类? - V2EX 升级至 2.0.0 有关时区的注意事项 - V2EX Jekyll 2 默认主题在 Chrome/WebKit 上那个不太正常的 header 高度 - V2EX Jekyll 2 默认主题里的一个小问题 - V2EX Jekyll 2.0.0 - V2EX 在ubuntu上安装jekyll遇到了问题 - V2EX 吐槽Disqus - V2EX 分享个人Jekyll博客 - V2EX
Jekyll x Liquid: 文章置顶功能的实现 - V2EX
szhshp · 2017-02-05 · via Jekyll

今天突然闲的蛋疼想把一些文章置顶, 于是就研究了一下如何实现, 还顺便把功能塞到了前段时间发布的- Jekyll 主题 里面

两个方案:

  • Server 端实现
  • Client 端实现

Server 端实现

其实很简单, 一开始以为无法对 Post 进行操作, 后来发现可以从 post 的 header 里面进行参数设置

layout: post
title: 《 10101 》 EP0 :我太受欢迎了该怎么办
category : Comic
tags : [Comic, 10101]
stickie: true

然后 liquid 进行判断

{* for post in site.posts *}
    {* if post.stickie != true *}
        {* continue *}
    {* endif *}
    <div>置顶文章细节</div>
{* endfor *}

{* for post in site.posts *}
    {* if post.stickie == true *}
        {* continue *}
    {* endif *}
    <div>普通文章细节</div>
{* endfor *}

当然这个可以进行多种扩展, 比如只输出特定类别的文章等等,这里就是个只输出带有 comic 这个 tag 的 post

{% for post in site.posts %}

    {% assign isComic = 0 %}

    {% for tag in post.tags %}
        {% if tag == comic %}
           {% assign isComic = 1 %}
        {% endif %}
    {% endfor %}

    {% if isComic == 0 %}
      {% continue %}
    {% endif %}

{% endfor %}

Client 端实现

我太懒了没去研究 o( ̄▽ ̄)o

用 JQuery.sort()给 DOM 排序再渲染一下即可

这个排序还要额外对时间进行比较 //果然懒一点是没错的 o( ̄▽ ̄)o

演示页面

szhshp 的第三边境研究所

参考