Hexo-theme-next: How do I do this? make featured image; image thumbnails in /archive; page without sidebar

Created on 14 Apr 2018  ·  4Comments  ·  Source: theme-next/hexo-theme-next

I am trying to replicate some behavior in the demo site,
http://notes.iissnan.com/archives/
specifically, creating what seem to be a "featured image" and also a "gallery" on the archives page.
However, I do not know how to do so.

I agree and want to create new issue


Expected behavior

1) I would like to make a photo gallery show up on the archives page timeline

gallery

2) I would like to make a "featured image" for my blog posts

featured_image

Actual behavior

No photos appear in timeline

Additionally, I have no idea how to make a "featured image". I tried adding to the frontmatter

---
layout: post
featured_image: test.png
---

However, this did not do anything.

Steps to reproduce the behavior

  1. hexo new post testgallery.md
---
type: "gallery"
layout: post 
title: testgall
photos:
 - images/pasted-0.png
 - images/pasted-1.png
date: 2018-04-14 01:27:32
tags:
---
test page

Go to http://localhost:4000/my-site/archives/ -- no images appear

NexT Scheme:

[] All schemes
[] Muse
[] Mist
[] Pisces
[x] Gemini

Next Theme v 6.1.0

#

What I really want to do, is to have a single "featured image" show up both on the index page and on the archives (timeline) pages. That is, a combination of being able to set a featured image in a post (maybe in the frontmatter), and have it show up in the archive with a picture thumbnail.

Is this possible?

I would also like to make a page without a sidebar. I am hopingI can make a my-site/themes/next/layout/nosidebar.swig file and then put in the frontmatter of a new page my-site/source/index/index.md' the yamltype: "nosidebar"` . I will try this tomorrow.

Thank you very much for the beautiful theme.

Backlog Question Solved

Most helpful comment

About the second read here, it is somewhat but still able to work.

About first maybe you should use layout: photo? I have read this but iissnan never record it in docs, if I remember he should write this in some issues, but I cannot find them, you can go to search.

And the third, I read templates and seems NexT has no config about this, you can add a if statement if you know swig, just add {% if page.sidebar != false %} to page.swig or post.swig before sidebar render and then add {% endif %} after it, and then add sidebar: false to your page, it should word...

All 4 comments

About the second read here, it is somewhat but still able to work.

About first maybe you should use layout: photo? I have read this but iissnan never record it in docs, if I remember he should write this in some issues, but I cannot find them, you can go to search.

And the third, I read templates and seems NexT has no config about this, you can add a if statement if you know swig, just add {% if page.sidebar != false %} to page.swig or post.swig before sidebar render and then add {% endif %} after it, and then add sidebar: false to your page, it should word...

I hope this page would be helpful for you.

Hi, I can confirm that putting in the post frontmatter "layout:photo" allows the photos to show up in the "archive" page. (And yes, this feature can only be found in source code: https://github.com/theme-next/hexo-theme-next/blob/cc07c43d002a13df9976c31813f774908fcd0d40/layout/_macro/post.swig)

I am slowly learning swig, thank you!

Was this page helpful?
0 / 5 - 0 ratings