Using an outside url in front matter


I’m obviously not understanding something key with Jekyll.

Each .md file in my _posts folder will be a portfolio item. Each portfolio item has a date, title, description, thumbnail, etc. All of that works fine for each project when I loop through the items. What I’d LIKE to do, is auto-generate a button, that gets its href from the url in the front matter.

But whenever I try this, the url instead becomes something like “http://localhost:4000/portfolio/2016/06/01/plan-it.html

Here’s my loop:

{% for items in site.categories.portfolio %}
            <a href="{{items.url}}" data-largesrc="images/portfolio/{{items.mainImage}}" data-title="{{items.title}}" data-description="{{items.description}}
            <span class='client'><strong>Client: </strong>{{items.client}}</span>
            <span class='role'><strong>Role: </strong>{{items.role}}</span>
            <span class='year'><strong>Launched: </strong>{{items:launchDate}}</span>">   
                <img src="images/portfolio/thumbs/{{items.thumbnail}}" alt="img09" />
{% endfor %} 

Thanks! - Bill


As of Jekyll 3.3 I think jekyll serve automatically prepends localhost to urls like this, which when doing dev locally can be handy.

What are you expecting items.url to produce?

When working locally does the url work? seems like it should.

How are you hosting the site in production? GH pages? have you checked it there?

more info on how jekyll handles some urls: