chrisdiana / cms.js

Client-Side JavaScript Site Generator
http://chrisdiana.github.io/cms.js
MIT License
3.06k stars 286 forks source link

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

Open fabricioanciaes opened 5 years ago

fabricioanciaes commented 5 years ago

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.

chrisdiana commented 5 years ago

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.

cdp1337 commented 1 year ago

image

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