Comments (4)
Look at this part of index.yaml:
data :
title : FROM first-post.yaml
body : FROM first-post.yaml
This tells yst to populate the both the title
and the body
template variables with the contents of first-post.yaml
. Now, this yaml file contains a yaml object with two fields, title and body. So both title
and body
get assigned a yaml mapping with two fields.
You can fix this, I think, by doing the following in index.yaml
:
post :
title : FROM first-post.yaml
body : FROM first-post.yaml
Then, in your string template, use $post.title$
and $post.body$
where you now have $title$
and $body$
.
from yst.
Thank you. That doesn't seem to work. second-post.html
is now:
<html>
<head>
<title>My Website - Second Post</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="css/screen.css" />
<link rel="stylesheet" type="text/css" media="print" href="css/print.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script src="js/nav.js" type="text/javascript"></script>
</head>
<body>
<div id="doc3" class="yui-t1">
<div id="yui-main">
<div id="maincol" class="yui-b">
<h1 id="section"></h1>
</div>
</div>
<div id="nav" class="yui-b first">
<ul class="nav"
><li
><a href="index.html"
>Hola</a
></li
><li class="active"
><a href="#"
>Blog »</a
><ul class="active"
><li
><a href="first-post.html"
>First Post</a
></li
><li class="current"
><a href="second-post.html"
>Second Post</a
></li
></ul
></li
></ul
>
</div>
</div>
</body>
</html>
That is, no body and no title. I've also tried:
data:
post:
title: FROM first-post.yaml
body: FROM first-post.yaml
This prints the string "FROM first post.yaml" at both title and body.
from yst.
Sorry, I didn't think it through. You're doing something a bit strange. Yst is designed to use yaml files like databases -- so, the files should be yaml lists of objects, not yaml objects as in your case.
Why don't you make each post a string template file, or just a plain markdon file? So, instead of first-post.yaml
, you'd have first-post.txt
.
# My first post
This is my first post.
index.yaml
would then be:
- url : index.html
title : Hola
template : index.st
- Blog:
- url : first-post.html
title : First Post
source : first-post.txt
- url : second-post.html
title : Second Post
source : second-post.txt
from yst.
The main reason is that I was thinking of using a somewhat complicated template, with space for comments, and I thought it would be easier if I had some control over what I was passing to the different parts of the template, as opposed to just a block that includes title, date, body, etc.
I'll try to make it work in the way you suggest. Thanks.
from yst.
Related Issues (20)
- Passing Pandoc Arguments to YST HOT 1
- HDBC sqlite3 not installing with cabal HOT 3
- html5 output? HOT 1
- Possibility of having data within document HOT 1
- On new install, using demo site, yst fails on april_events.tex HOT 3
- yst.cabal is out of date, as it's no longer possible to install via "cabal install yst". HOT 4
- Please support XML data
- `cabal install yst` fails HOT 2
- storee HOT 1
- can give a sample site which is based on yst?
- Typo in readme
- Support custom `$nav$` rendering using templates HOT 4
- How can one implement dynamic pages. [feature request][discussion] HOT 4
- installation fails on nixos HOT 4
- yst won't install on Ubuntu 18.04 HOT 1
- Pandoc 2.9.* compatibility
- Installation fails HOT 5
- Failed to build yst - Ambiguous occurrence ‘defaultTimeLocale’ HOT 1
- yst fails to build with aeson >= 2
- Build fails: yst-0.7.1.3 from Cabal on MacOS -- "writeDocbook5" capitalization? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yst.