Giter Club home page Giter Club logo

Comments (17)

wzpan avatar wzpan commented on July 4, 2024

图片建议放在 source/images 目录下。然后使用 [config.root]/images/xxx 的形式引用,其中 [config.root] 是你的站点的根路径。可以查看我的demo站点的 source分支 了解图片的放置方法以及 feature 的书写方法。

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

非常感谢,最开始使用hexo 2.0时也是这种方式引用图片,后来升级hexo 3.0之后有个post_asset_folder功能选项,觉得非常方便,就使用了这个,请问现在有没有办法还是使用将对应帖子的图片直接放到相应帖子名称文件夹的方法。

from hexo-theme-freemind.

wzpan avatar wzpan commented on July 4, 2024

主页的图片如果不使用 post_asset_folder 变量,直接引用图片路径是否可以解决问题?即:
根路径/文件夹名/图片名

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

非常感谢,这样可以解决主页上的feature中需要显示的图片问题,还想问两个问题,谢谢!

  1. 像我下述图片中描述的1中填写的路径很长,有没有办法可以直接引用某个变量来实现让它直接引用post_asset_folder中的图片?
  2. 对2处的位置是直接引用post_asset_folder中的图片,当将放在图片下面时,理论上主页应该显示出该图片,但主页上却无法下载引用图片地址,主页上的图片引用路径依然是根目录,无法自动引用post_asset_folder路径,这个可否解决?
    谢谢

from hexo-theme-freemind.

wzpan avatar wzpan commented on July 4, 2024

应该可以。我晚点看看。

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

热心大神!什么时候您有空了都可以,谢谢!

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

2015-10-10_141205

刚才图片没出来

from hexo-theme-freemind.

wzpan avatar wzpan commented on July 4, 2024

试试更新下主题。然后 feature 的路径也改成使用和正文一样的 post_asset_folder 短路径。

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

这样可以完美解决我上面提到的问题1,对于问题2,是不是也需要大神修改哪里对应的代码,谢谢

from hexo-theme-freemind.

wzpan avatar wzpan commented on July 4, 2024

我看了一下官方提供的 Light 和 Landscape 的源码,发现他们的主题同样没有对首页文章内容中的图片路径进行处理。我认为这个问题应该是共性的。

要解决这个问题,我想了三个方法:

  1. 修改主题,如果要避免这种错误,我能想到的办法是在模板中插入对文章内容的处理,将这些内容中的短路径全局替换成完整路径。但需要小心避免错误替换外链的图片。我感觉这种替换的实现有点 dirty 。
  2. 修改 hexo 对 asset 的处理,增加对首页中的�文章内容的短路径。我更倾向于这种做法。也许我会找时间给 hexo 提交 pull request 。
  3. 目前更建议你将需要作为 excerpt 的部分中的图片链接改成完整的链接。即 当前文章路径/图片名 的形式。

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

大神,正如你说所,最近更换主题时试用多个主题,都有这种excerpt中出现无法引用短路径的问题,最后给issue都没能回复,试用到你这里给了回复,在hexo那里没有更新之前,我还是先使用你提供的方案3吧,放

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

谢谢,笔误

from hexo-theme-freemind.

wzpan avatar wzpan commented on July 4, 2024

FYI ,看看这篇文章:http://timnew.me/blog/2014/08/19/use-hexo-asset-folder-to-manage-resource-used-by-post/ 。应该可以解决你的问题。

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

谢谢,在hexo官方没出解决方法或者没有其他人长期维护的代码之前我先使用你说的直接引用绝对路径的方式解决吧。刚试了那个插件,发现不支持hexo 3.1.1

from hexo-theme-freemind.

zeyios avatar zeyios commented on July 4, 2024

官方的解决方案

from hexo-theme-freemind.

wzpan avatar wzpan commented on July 4, 2024

@AsiamCn 👍 。请 @blueyi 测试下是否解决。如果是,请关闭本issue。

from hexo-theme-freemind.

blueyi avatar blueyi commented on July 4, 2024

谢谢 @AsiamCn

from hexo-theme-freemind.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.