hexojs / hexo

A fast, simple & powerful blog framework, powered by Node.js.
https://hexo.io
MIT License
39.54k stars 4.86k forks source link

photo url setting problem #718

Closed m80126colin closed 10 years ago

m80126colin commented 10 years ago

I tried to insert some photo into my articles but met a problem. If my host name is http://<username>.github.io, there is no problem; however, it happened when I tried to deploy to http://<username>.github.io/blog. There is my markdown file with the image /img/images.jpg

layout: photo
title: TESTTT
date: 2014-07-11 07:57:25
photos:
- /img/images.jpg

---

# QAQ

![](/img/images.jpg)

FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU

Thus, the position of images.jpg will be at http://<username>.github.io/blog/img/images.jpg. But both gallery photo and insert images were strange. My generated HTML is as follow:

<div class="article-gallery">
  <div class="article-gallery-photos">

      <a class="article-gallery-img fancybox" href="/blog//img/images.jpg" rel="gallery_lx33mum1aoharan8">
        <img src="/blog//img/images.jpg" itemprop="image">
      </a>

  </div>
</div>

The url /blog//img/images.jpg of gallery photo sometimes worked.

<p><img src="/img/images.jpg" alt=""></p>
<p>FUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU</p>

But this url actually points to http://<username>.github.io/img/images.jpg where has nothing! I also checked public file and confirmed that this image is really at its correct position.

sergiolepore commented 10 years ago

Use url_for helper: http://hexo.io/docs/helpers.html#url_for

m80126colin commented 10 years ago

@sergiolepore Sorry, I don't know how to use url_for in my markdown file.

Xuanwo commented 10 years ago

You has already know where your imgs are. Just use ![](http://<username>.github.io/blog/img/images.jpg) to insert.

m80126colin commented 10 years ago

@Xuanwo Yes, I know where the images are, but it seems that something improper with respect to design.

Xuanwo commented 10 years ago

@m80126colin With markdown, you can't order the size of your image. If you want to, please use html.

Xuanwo commented 10 years ago

@m80126colin If problem has been solved, please close the issue. Thanks~