网页页面布局/搜索引擎优化的策略主要有
建议浏览hexo博客
两步设置,一步使用
以hexo-theme-next 7.6.0演示
设置
一.
修改themes\next\layout下的index.swig文件
第10行和12行是需要自己添加的,其他的保留原配置
{% extends '_layout.swig' %}
{% import '_macro/sidebar.swig' as sidebar_template with context %}{% block title %}{{ title }}{%- if theme.index_with_subtitle and subtitle %} - {{ subtitle }}{%- endif %}{% endblock %}{% block content %}<div class="posts-expand">{%- for post in page.posts.toArray() %}{%- if post.notshow != true %}{{ partial('_macro/post.swig', {post: post, is_index: true}) }}{%- endif %}{%- endfor %}</div>{% include '_partials/pagination.swig' %}{% endblock %}{% block sidebar %}{{ sidebar_template.render(false) }}
{% endblock %}
二.
修改hexo主文件夹下的\scaffolds\post.md文件
---
title: {{ title }}
date: {{ date }}
notshow: false
tags:
---
使用
需要在主页隐藏文件时
在font-matter部分添加
notshow: true
不需要在主页隐藏文件时
notshow不需要添加
特色与建议
建议
缺点是您的总文章数没变
如果你需要不在主页显示又不增加总文章数量
建议插件hexo-generator-index2(官方插件)
警告:可能弄崩网站,本人尝试失败,next主题给我报了一堆错误
更优雅的隐藏文章
官方介绍
官方插件库
特色
1.修改swig文件时,参考上下文语法%后面添加了-,更适应Next 7.6.0
2.添加font-matter属性值时,为其设置默认值false(这里不确定不添加这一步是否影响使用)
参考文章
淡之梦 写的:Hexo 设置首页隐藏指定文章
100斤 写的:hexo首页优雅的隐藏部分文章