LouisBarranqueiro / hexo-theme-tranquilpeak

:lipstick: A gorgeous responsive theme for Hexo blog framework
https://louisbarranqueiro.github.io/hexo-theme-tranquilpeak/
GNU General Public License v3.0
1.86k stars 484 forks source link

how to add a page? #35

Closed digifu closed 9 years ago

digifu commented 9 years ago

I tried to add a page but pictures and links are not working. Is it possible to add pages with your theme?

LouisBarranqueiro commented 9 years ago

Of course it's possible. Can you show me the source code of your page and folder architecture: public/YOUR_PAGE and source/YOUR_PAGE? Check that your images must be in public/YOUR_PAGE/ folder to be available from index.html page with relative url like photo.png. if there is a subfolder like public/YOUR_PAGE/subfolder/, images will be reach with subfolder/photo.png from public/YOUR_PAGE/index.html

digifu commented 9 years ago

When I click the "Test" link, I can see the page but the pictures are not working, instead of the last entry.

screenshot - 27 06 2015 - 15 52 08

screenshot - 27 06 2015 - 15 52 42

The picture are in the subfolder index, like /source/test/index/laos.jpg Here is the code of the /source/test/index.md

title: "test" thumbnailImage: index/laos.jpg coverImage: index/laos1.jpg photos: - index/myanmar.jpg - index/laos.jpg - index/laos1.jpg --- {% asset_img index/laos.jpg [title] %} ![Alt text](/test/index/laos.jpg)

LouisBarranqueiro commented 9 years ago

you're right, there is a bug with image urls. I would like to have your opinion. I take an example:
you create a page "test". so in this folder, you have index folder and a file index.md file. in test folder, you create an other file hello.md and a folder hello. So this 2 posts in testpage will be reachable at http://yourblog.com/test/index.html and http://yourblog.com/test/hello.html. Each page(hello.md and index.md have images) I would like to know what do you prefer in front matter. 1 hello.md content :

title: "hello"
thumbnailImage: hello/tranquilpeak.png
coverImage: hello/tranquilpeak.png
photos:
- hello/tranquilpeak.png
---

![Alt text](hello/tranquilpeak.png)

2 hello.md content :

title: "hello"
thumbnailImage: tranquilpeak.png
coverImage: tranquilpeak.png
photos:
- tranquilpeak.png
---

![Alt text](hello. tranquilpeak.png)

Normally, tranquilpeak have the second behavior for posts because it easier for user to just write the relative url. But a page can have multiple posts in, so you want to maybe share images between them, or other things like that. Do you want that front matter reach /your_page/ folder or /your_page/your_post_folder/, in your case /test/ or /test/hello/ ? Tell me :) behavior 1 or 2?

digifu commented 9 years ago

Sorry for the delay. Went from Asia back to Europe.

I would prefer 1. But only because I don't see the advantage of 2. What is the point in having posts for a single page? Or do you mean subpages?

LouisBarranqueiro commented 9 years ago

Currently, for posts, the behavior is 2. User doesn't need to write the folder name everywhere, and if he change the title of the post (then the name of the folder which contains photos) , he will not have to rename each lines where there is the old folder name. Behavior 2 is more dynamic and better for posts. but for a page i'm not sure. it depends what does user do with. So ? :D

LouisBarranqueiro commented 9 years ago

i'm still waiting your answer to push changes :)

digifu commented 9 years ago

I think 2. is better. Tranquilpeak and hexo is mainly for blogging. So it should be as easy as possible for blogposts.

LouisBarranqueiro commented 9 years ago

Got it! :)

LouisBarranqueiro commented 9 years ago

Tranquilpeak 1.2.0 is here and fix this bug :)