Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何实现首页文章,只显示标题而不是全文? #244

Closed
hhstore opened this issue Jun 25, 2015 · 15 comments
Closed

如何实现首页文章,只显示标题而不是全文? #244

hhstore opened this issue Jun 25, 2015 · 15 comments

Comments

@hhstore
Copy link

hhstore commented Jun 25, 2015

查了一下,多数说是修改_config.yml

archive: 1
category: 1
tag: 1

但是,对于Next主题,并没有卵用.

有知道如何修改的吗?

@hhstore
Copy link
Author

hhstore commented Jun 25, 2015

找到个鸡肋的解决办法.
文章头添加

title: Hexo示例文档
---

本篇为Hexo示例文档.

<!-- more -->

这样主页就只显示 文章标题+摘要部分.

暂时这么用着吧.

@iissnan
Copy link
Owner

iissnan commented Jun 25, 2015

改模板文件应该可以

@iissnan
Copy link
Owner

iissnan commented Jun 26, 2015

另外,通过自定义 CSS 也可以做到

@guxiaole
Copy link

guxiaole commented Jul 1, 2015

具体怎么修改模版文件的?能详细说说吗?小白一枚

@hhstore
Copy link
Author

hhstore commented Jul 2, 2015

@guxiaole 可以参考我的博客,有篇配置教程.还比较详细.

http://www.selfrebuild.net/2015/06/24/Github-Hexo%E6%90%AD%E5%BB%BA%E5%8D%9A%E5%AE%A2%E6%95%99%E7%A8%8B/

@eurusd
Copy link

eurusd commented Jul 2, 2015

只显示标题,很难看的。

@guxiaole
Copy link

guxiaole commented Jul 2, 2015

其实我不是想只是显示标题的,我按照next主题默认配置 但是首页显示文章全文,没有read more !有些文章很长 全文显示出来很难看的呀.。我想显示标题和文章部分就可以了。

@hhstore
Copy link
Author

hhstore commented Jul 2, 2015

@guxiaole 本issue下,我不是已经给出解决办法了?

title: Hexo示例文档
---

本篇为Hexo示例文档.  # 这里是摘要部分,写1~2句话,就实现不全显示博文了..

<!-- more -->


### 下面是正常的 markdown 博客,就可以了.......


你添加博文.md 文件, 文本头,是如上这种.就ok. 效果,参考我的博客主页..

http://www.selfrebuild.net/

@eurusd 只显示标题,更简洁...各有喜好吧...目前只好这样用着.

@iissnan 建议Next 添加 主页博客目录显示选项.可以根据喜好切换.毕竟好多人对Hexo不是很熟悉.

@flashlab
Copy link
Contributor

flashlab commented Jul 2, 2015

设计不就是为了凸现个性吗,满足每个人的口味何来个性?我想说的是,修改也要有个底限,改多了反而画蛇添足。然后,这里不是贴吧,请注意语气和用词。
多说几句,我很反感那些从头到脚的事无巨细的傻瓜教程,结果就是越来越少的人愿意去学习官方文档,出现问题描述不清,甚至根本问错了地方。提问本身没有错,但提问之前请三思,首先有个愉快的讨论环境然后我们再来解决问题。不说要求你认真打标点符号,说话的态度起码要注意点吧。当然,这是是我个人的见解,与主题以及next无关,有话说请发邮件。

@guxiaole
Copy link

guxiaole commented Jul 2, 2015

问题已经 解决,,so 谢谢各位啦!

@araolin
Copy link
Contributor

araolin commented Jul 3, 2015

@hhstore 如果你说的是首页只显示标题,连全文,摘要什么的都不要的话,可以修改_macro目录下的post.swig文件,路径在你的hexo站点\themes\next\layout_macro,把下面的代码给注释或者删除掉

       {% if post.description %}
          {{ post.description }}
          <div class="post-more-link text-center">
            <a class="btn" href="{{ url_for(post.path) }}">
              {{ __('post.read_more') }} &raquo;
            </a>
          </div>
          {% elif post.excerpt  %}
          {{ post.excerpt }}
          <div class="post-more-link text-center">
            <a class="btn" href="{{ url_for(post.path) }}{% if theme.scroll_to_more %}#more{% endif %}">
              {{ __('post.read_more') }} &raquo;
            </a>
          </div>
        {% else %}
          {{ post.content }}
        {% endif %}

@iissnan iissnan closed this as completed Nov 4, 2015
@onshek
Copy link

onshek commented Sep 27, 2016

@guxiaole 最终是如何解决的呢?

@starryfei
Copy link

搜索"auto_excerpt",找到如下部分:
auto_excerpt:
enable: false
length: 150
至于要修改enable: true就可以实现实现首页文章,只显示标题和摘要而不是全文

@Zhang21
Copy link

Zhang21 commented Aug 31, 2017

http://theme-next.iissnan.com/faqs.html#read-more

wangpei72 pushed a commit to wangpei72/hexo-theme-next that referenced this issue Sep 17, 2021
Co-authored-by: Renovate Bot <bot@renovateapp.com>
@yexia553
Copy link

yexia553 commented Jun 6, 2023

可以使用这个插件
https://github.com/chekun/hexo-excerpt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants