JSRocksHQ / harmonic

The next static site generator
http://harmonicjs.com/
MIT License
282 stars 26 forks source link

Post resume #157

Open viniciusdacal opened 9 years ago

viniciusdacal commented 9 years ago

Does Harmonic have something like the post.excerpt from jekyll? that takes the first paragraph from a post?

UltCombo commented 9 years ago

Yes -- in the index and category pages, the excerpt part (before the <!--more-->) is available as the post metadata's content property:

{% for post in posts %}
    {{post.content}}
{% endfor %}

IMO this seems a bit confusing though, as in the posts template the post.content returns the full post content.

It would perhaps be a good idea to rename or alias the excerpt property and make it available on all generated content that involves posts. /cc @jaydson

UltCombo commented 9 years ago

Actually, I believe the post excerpt is also available in the the posts template as post.metadata.content.

I believe "content" is a rather confusing name for an excerpt, we should rename or at least alias it (depending on how many harmonic-themes are published on npm).

UltCombo commented 9 years ago

Or we can just create a new property and keep the old one for back-compatibility:

@jaydson WDYT?

viniciusdacal commented 9 years ago

Thanks, works perfectly here.

UltCombo commented 9 years ago

I still think we should create a better alias, so keeping this issue open for now.

jaydson commented 9 years ago

Yes, you're right @UltCombo, it's confusing indeed.

metadata.content: the content prior to , or the full content if there is no metadata.excerpt: the content prior to , or empty string if there is no

Sounds good to me