cms.js icon indicating copy to clipboard operation
cms.js copied to clipboard

Can't put url on post metadata and pull them via the template engine

Open fabricioanciaes opened this issue 6 years ago • 2 comments

I was trying to put urls in the post listings. Sort of a featured image for each post.

---
layout: post
title: New feature TEST
excerpt: Cum sociis natoque penatibus et magnis dis parturient montes...
author: Chris
image: http://placehold.it/300x300

---

As a test I've put a url.

Then modified the layout on the post listings to reflect the changes:

<% if(post.image) { %>
  <div class="post-image">
    <img src="<%= post.image %>" alt="">
  </div>
<% } %>

and the output html looks like this:

<div class="post-image">
  <img src="http" alt="">
</div>

Is it intentional? I suppose the // in the url are getting escaped by themselves.

fabricioanciaes avatar Jan 02 '19 14:01 fabricioanciaes

At first glance this looks like a bug with the front matter parser. Definitely not intentional behavior. Probably right that the "//" is getting escaped or there might be a split by ":" that's causing the issue.

chrisdiana avatar Jan 13 '19 06:01 chrisdiana

image

I recently found this project and am having some fun. ;)

cdp1337 avatar Nov 05 '22 17:11 cdp1337