docpad

How to get collections from sub-folder in docpad?

廉价感情. 提交于 2020-01-05 09:12:57
问题 my folds structure are something like this: documents techs docs I want to get a collection from docs, my code is : techs: -> @getCollection("html").findAllLive({relativeOutDirPath: /techs/docs/},[{date: -1}]).on "add", (model) -> model.setMetaDefaults({layout: "post"}) It just won't works... Could somebody tell me what's going on? 回答1: The /techs/docs/ in {relativeOutDirPath: /techs/docs/} is parsed as a regular expression, rather than a string. Wrap it in quotes so you have

Loop through posts' date in order to make archive in DocPad

跟風遠走 提交于 2020-01-05 05:47:09
问题 Here's some pseudo-code of what I want to achieve: for year in post.date h1 year for month in post.date h2 month ul li post entry That's the pseudo-code. However I don't have enough experience to achieve this. The file in which this would happen is this one: https://github.com/Greduan/eduantech.docpad/blob/master/src/documents/posts.html.eco And it would be in the eco language. I'm using Moment.js as well in case that's necessary. Even if you don't provide the exact code, a general direction

Generate different docpad collections for different languages

半世苍凉 提交于 2020-01-01 00:44:51
问题 I want to tune my multilungual DocPad blog so that pages ended with *.ru.md go into /ru/ directory, and pages ended with *.en.md go into /en/ directory. Let's say this is the initial structire src/ pages/ page1.ru.md page1.en.md page2.ru.md And this is what I want: ./ en/ page1.html ru/ page1.html page2.html ./ because I am going to host with gh-pages . And the same for posts. I would like to store them in src/ posts/ post-about-docpad.ru.md post-about-docpad.en.md And get ./ en/ posts/ post

Generate different docpad collections for different languages

纵然是瞬间 提交于 2020-01-01 00:44:05
问题 I want to tune my multilungual DocPad blog so that pages ended with *.ru.md go into /ru/ directory, and pages ended with *.en.md go into /en/ directory. Let's say this is the initial structire src/ pages/ page1.ru.md page1.en.md page2.ru.md And this is what I want: ./ en/ page1.html ru/ page1.html page2.html ./ because I am going to host with gh-pages . And the same for posts. I would like to store them in src/ posts/ post-about-docpad.ru.md post-about-docpad.en.md And get ./ en/ posts/ post

Bootstrap drop-down menus and tabbable tabs on Docpad

牧云@^-^@ 提交于 2019-12-31 06:26:29
问题 I've created a Docpad site using the Twitter Bootstrap skeleton. I cannot get either Bootstrap's tabbable tabs or drop-down menus to work. They render, but do not function. From research on Stackoverflow it appears that additional jquery needs to be included for these Bootstrap functions. I've tried to add it in to Docpad but have been unsuccessful. Has anyone gotten these Bootstrap functions to work in Docpad? 回答1: for Boostrap, to run drop-down menu i know its need this code in a page to

Docpad: using extendTemplateData via mongoose callback

时光怂恿深爱的人放手 提交于 2019-12-25 07:29:04
问题 I'm trying to build a simple plugin to get get data from Mongo into an object over which I can iterate when rendering. The full code is in my project, but the essence of it is a failed attempt to emulate the feedr example. I know the mongoose stuff is working as the console log works, but getting the content sent to the docpad object is defeating me class mongoPlugin extends BasePlugin name: 'mongo' # Fetch list of Gigs getGigsData: (opts) -> mongoose.connect ('mongodb://localhost/test') db =

docpad grunt iteration over all html files

 ̄綄美尐妖づ 提交于 2019-12-25 07:10:06
问题 I am using the docpad-plugin-grunt with several grunt tasks. I wonder what is the best way to run tasks over all docpad generated html documents without individual files to be specified in the gruntfile.js. Is there a routine where docpads handing over to grunt all filenames? Can dopad handle the iteration or is a seperated script needed? 回答1: I don't think grunt is the way to go for this, what you really want to do is hook in to the rendering process that docpad does for each document.

Docpad : show error/success message on contact form

穿精又带淫゛_ 提交于 2019-12-24 15:46:54
问题 I added a route in my docpad.coffee file to handle form submissions, that I validate using the express-validator middleware. Now depending on the validation, I want to redirect the users to the same contact page but displaying either a success message when validation is successful (here I'll send an email), or display the error messages. I didn't manage to pass the validation message to the template to display it. I tried almost all combinations of dynamic: true/false , res.locals =

Integrate express.js application and docpad

和自甴很熟 提交于 2019-12-22 09:46:26
问题 I've been using docpad to pre-generate a front-end html/js application (using docpad generate --env static ). After a few hangups and a bug fix from balupton it now works great and saves me a lot of time. I simply copy these file to an existing apache server for deployment. I have now also created a node.js/express.js back-end application that uses a simple api to feed data to the client. This code was created and run independently from the docpad/static files generated as I discussed above.

How to have a the docpad grunt skeleton min vendor js files with live reload

…衆ロ難τιáo~ 提交于 2019-12-21 22:21:36
问题 I'm using skeleton #2, HTML5BP + Grunt. The first time I docpad run the following happens: info: LiveReload listening to new socket on channel /docpad-livereload Performing writeFiles (postparing) at 0/1 0% [...] Running "min:js" (min) task File "../out/scripts/all.min.js" created. Uncompressed size: 298495 bytes. Compressed size: 38257 bytes gzipped (106756 bytes minified). Which is as is supposed to be. However using the livereload plugin if I change a template or document file, I get: -