Comments (3)
It's actually possible to solve the problem. The value of preface
variable is used in a Techy command. This means that we could do whatever we need with the string before to send it to the page. So, if we have the following code in our markdown:
---
date: 11-01-2014
title: An article with code
preface: Curabitur consequat <img src="{siteURL}themes/default/public/img/favicon.png" /> ligula iaculis elit aliquet tincidunt. Proin aliquet massa venenatis, porta lorem.
tags:
- javascript
- nodejs
---
We ma replace the {siteURL}
marker with the actual path:
var articles = this.pages('articles', 'date');
var html = '', to = max || articles.length;
for(var i=0; i<to; i++) {
var article = articles[i];
html += this.template(template, {
title: article.get('title'),
preface: article.get('preface').replace('{siteURL}', this.get('paths').root),
link: this.linkto(article),
date: article.get('date'),
tags: article.get('tags').join(', ')
});
}
from techy.
I should mention that a Techy command is run in the context of the current page. So, this.get('paths').root
is pointing to the right place. Actually the value of this root
property is different for every page and depends on its position based on the root project's directory.
P.S.
let me know if the trick above works for you
from techy.
Solved - yes I figured it out from the code - cool
from techy.
Related Issues (20)
- Change default output folder name to dist HOT 2
- Do we really need themes? HOT 25
- Default theme configuration HOT 2
- Blog layout? HOT 2
- Minifying SCSS HOT 2
- Empty SCSS files cause node to crash and burn HOT 4
- Super simple (gulp) usage? HOT 3
- code prettifying with prism.js? HOT 4
- Improvement on CSS watch HOT 2
- Unable to set custom source directory for MD pages HOT 1
- Pages() usage? HOT 3
- Setting src and dest to same path == Misery HOT 3
- Modular content HOT 4
- Using as Gulp plugin throws TypeError and packing error HOT 10
- Templates don't have access to Techy functions
- --src path still exists in --dest output
- Techy not working
- Automatically minifying css, html and js final files from _dist
- Organizing the MD source files within a folder rather than on root
- Is this project active?
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 techy.