yuang01 / hexo-theme-bamboo

Hexo博客主题,功能强大,美观
https://hexo-theme-bamboo.netlify.app/
MIT License
414 stars 59 forks source link

There will be some mistakes to path of image when "post_asset_folder" is true on root config. #18

Closed Alpaca0x0 closed 2 years ago

Alpaca0x0 commented 2 years ago

當 root config 下的 "post_asset_folder" 為 true 時,hexo 會將每篇文章生成獨立的 directory。 因此可以將該文章的圖檔放至文章所對應的 directory 中,但該主題似乎並未支持文章直接引入專屬目錄的圖檔。

yuang01 commented 2 years ago

操作1: 将根目录的post_asset_folder属性设置为true

操作2:使用命令

hexo new aaa

会在source/_posts文件夹下生成一个叫做aaa的文件夹和一个叫aaa.md的文件

操作3:例如将2.jpg,放入生成的aaa文件夹下,在aaa.md文件中使用如下方式引入图片

---
title: aaa
date: 2021-08-20 14:03:20
tags:
---

![Image 22222](2.jpg)

是可以显示图片的

image

yuang01 commented 2 years ago

具体请看 https://hexo.io/zh-cn/docs/asset-folders.html

Alpaca0x0 commented 2 years ago

更正,是文章 cover 的部份。 封面圖路徑有誤,文章內圖片引入沒問題。

yuang01 commented 2 years ago

这样图片在轮播图上是显示不了的

---
title: aaa
date: 2021-08-20 14:03:20
tags:
swiper: true
swiperImg: 2.jpg # 这样显示不了
---

![Image 22222](2.jpg)

需要在source下创建一个文件夹,例如叫img,这样写才能显示

---
title: aaa
date: 2021-08-20 14:03:20
tags:
swiper: true
swiperImg: /img/2.jpg
---

![Image 22222](2.jpg)

或者将图片放在主题文件夹themes\hexo-theme-bamboo\source\medias

---
title: Hexo主题--Bamboo介绍
date: 2020-09-14 14:06
swiper: true # 将改文章放入轮播图中
swiperImg: '/medias/1.jpg' 
img: '/medias/1.jpg'
categories: 前端
tags: [Hexo, hexo-theme-bamboo]
top: true

---
Alpaca0x0 commented 2 years ago

了解,非常感謝。