zoukankan      html  css  js  c++  java
  • jacman主题分页出现问题(Next<span></span>)

    应该是hexo更新的问题,但是jacman主题很久没有更新了,所以有些语法和现在的有差别。

    主页的文章分页出现Next<span></span>和<span></span>Prev,也就是html标签没有被正确渲染。同样在archives也有同样的问题

    经过一番尝试,搜索,查看ejs模板文件。终于找到了问题。

    官方文档:https://hexo.io/zh-cn/docs/helpers.html

     Ctrl+F搜索关键字:paginator

     可以看到,需要设置escape参数才能达到不转义html标签的效果。

    更改两个模板文件。位置分别在

    N:log hemesjacmanlayoutindex.ejs

    N:log hemesjacmanlayout\_partialarchive.ejs

    在paginator下添加一行escape:false,记得在上一行还要添加一个逗号

    index.ejs如下

    <div id="main">
    <% page.posts.each(function(item){ %>
      <%- partial('_partial/article', {item: item, index: true,desc: true}) %>
    <% }); %>
    <% if (page.total > 1){ %>
      <nav id="page-nav" class="clearfix<% if (theme.index.expand != true) { %> unexpand<% } %>">
        <%- paginator({
          prev_text: '<span></span>Prev',
          next_text: 'Next<span></span>',
          escape:false
        }) %>
      </nav>
    <% } %>
    </div>

    archives.ejs如下

    <%
    var title = '';
    var icon = '';
    if (page.category){
      title = page.category;
      icon = 'category';
    };
    if (page.tag){
      title = page.tag;
      icon = 'tag';
    };
    if (page.archive){
      icon = 'archive';
      if (page.year) title = page.year+  (page.month ? '/' + page.month : '');
      else title = __('archive_a');
    };
    %>
    
    <div class="archive-title" >
      <h2 class="<%= icon %>-icon"><%= title %></h2>
      <% if(page.archive){ %>
      <div class="archiveslist archive-float clearfix">
       <%- list_archives({format:__('archive_date')}) %>
     </div>
      <% } %>
    </div>
    <div id="main" class="archive-part clearfix">
      <div id="archive-page">
    <% page.posts.each(function(item){ %>
      <%- partial('_partial/article_row', {item: item, index: true}) %>
    <% }); %>
    <% if (page.total > 1){ %>
      <nav id="page-nav" class="clearfix archive-nav">
        <%- paginator({
          prev_text: '<span></span>Prev',
          next_text: 'Next<span></span>',
          escape:false
        }) %>
      </nav>
    <% } %>
      </div>
    </div>
  • 相关阅读:
    HDU 4165 pills
    POJ 2125 Destroy The Graph
    POJ 2075 Tangled in Cables
    NYOJ Number SequenceProblem F
    PHP Eval研究笔记
    PHP 学习备忘(更新中)
    iOS学习笔记1 版本控制
    PHP全局缓存上栽的坑及其他【反面教材系列】
    iOS学习笔记2 Code Format
    iOS学习笔记4 垃圾回收初涉
  • 原文地址:https://www.cnblogs.com/roadwide/p/14245766.html
Copyright © 2011-2022 走看看