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

About variable "page.excerpt" #1143

Hill1942 opened this Issue Mar 25, 2015 · 6 comments


8 participants

Hill1942 commented Mar 25, 2015

when I try to get the value of page.excerpt by <%= page.excerpt %>, there's nothing out.

So where to define page.excerpt?


This comment has been minimized.

jorgt commented Mar 25, 2015

Same issue with posts. post.excerpt is always available but always empty. This is using 3.0.0.

I tracked the offending code to the regex in hexo/lib/plugins\filter\after_post_render\excerpt.js

I'm using this code until this is patched. It works for me but has not been tested on anything but my theme.


This comment has been minimized.

bvodola commented May 15, 2015

Use a html comment with the word "more" to mark the excerpt of your post, like this:

title: post title
This part is the excerpt, get it with the <%- post.excerpt %>
<!-- more --> 
This is the rest of the post. You can get it with <%- post.more %>

All the text after the <!-- more --> is only displayed when you view the page of the post.


Edit: You can also use this hexo-front-matter-excerpt plugin to define the excerpt in the front matter with whatever content you want.



This comment has been minimized.

felipesousa commented May 21, 2015

@bvodola thanks brother, you help me! thanks

@leesei leesei closed this Jul 16, 2015


This comment has been minimized.

0326 commented Dec 5, 2015

it works! thanks @bvodola

@CodeDaraW CodeDaraW referenced this issue Mar 21, 2016


Ask for help #1


This comment has been minimized.

psychicalcoder commented Aug 10, 2017

@bvodola thanks
I've been trying to solve this problem for hours QAQ


This comment has been minimized.

connor11528 commented Aug 12, 2017

I am also having an error rendering the post.excerpt. I specified more in my blog posts but when I look at the source, excerpt is always set to an empty string, despite the more html comment. This is the code I am using to grab the excerpt that does not render it.

I am using

  • "hexo": "^3.3.8"
  • "hexo-renderer-ejs": "^0.1.0"
  • "hexo-renderer-marked": "^0.2.4"
            <% site.posts.each(function(post, i){ %>
                <div class='notification is-danger post'>
                    <a href="<%- url_for(post.path) %>" class='underline-link' style='padding-bottom: 8px;'>
                        <%= post.title %>
                    <p class='padding-bottom-10'>
                    <% post.tags.each(function(tag){ %>
                        <span class="tag"><%= %></span>
                    <% }); %>
                    <p>Excerpt: <%- post.excerpt %></p>
                      <%= date(, config.date_format) %> 
            <% }); %>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment