csk87
csk87

Reputation: 199

Jekyll images getting wrong url on release (not on localhost)

I just tryed to release my first Jekyll site from localhost to a live version and got some img-url problems. I have got a image folder in the root that contains a subfolder called staff where I get my staffmembers images.

My problem is that when I loop through my staff members on the staff.html the page tryes to get the images from:

mysite/staff.html/images/staff/img1.png

... when the image accually is in:

mysite/images/staff/img1.png

The staff.html file looks like this:

 {% for member in members %}
        <div class="col-sm-12 col-md-10 col-lg-3">
          <div class="card">
            <img src="{{ member.img }}" class="card-img-top img-fluid" alt="{{member.name}}">
            <div class="card-body">
              <h4 class="card-title">{{ member.name }}</h4>
              <ul>
                <li><b>{{ member.position }} <br> {{ member.section }}</b></li>
                <li><a href="mailto:{{ member.email }}"> {{ member.email }} </a></li>
                <hr>
                <li>Mobil: {{ member.mobil }}</li>
                <li>Kontor: {{ member.office }}</li>
              </ul>
            </div>
          </div>  
        </div>
        {% endfor %}

I also have a folder in the root called '_staff' that contains .md files for all staff members that looks like this:

name: Jon doe
position: supervisor 
section: carpenter
email: [email protected]
mobil: 073-000 00 00
office: 08-000 00 00
img: images/staff/img1.jpeg

any ideas how to solve?

Upvotes: 1

Views: 198

Answers (1)

Mr. Hugo
Mr. Hugo

Reputation: 12582

Replace images/staff/img with /images/staff/img. The first slash tells the server to look in the root (top folder of the website).

Tip: You could/should also check that you set permalink: pretty in your _config.yml file. That should hide the .html exentsion in your URL's. Source

Upvotes: 1

Related Questions