静态与在docpad系统动态内容 - 如何创建动态内容? [英] Static vs. dynamic content in docpad system - how to create dynamic content?

查看:113
本文介绍了静态与在docpad系统动态内容 - 如何创建动态内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

DocPad被描述为比得上其他静态站点发电机,但它也被描述为不限于静态站点代

DocPad is described as being comparable to other static site generators, but it is also described as being "not limited to static site generation".

我一直在浏览DocPad网站和其他文件,还没有能够找到任何东西,似乎解释了如何将动态内容,并可能涉及哪些类型的限制?

I've been browsing the DocPad website and other documentation and haven't yet been able to find anything that seems to explain how to incorporate dynamic content, and what types of limitations may be involved?

作为一个相对的初学者,我想知道如果有人能帮助我更好地理解方法,从而动态内容将纳入DocPad ...?例如AJAX和动态服务器端脚本做这样的事情动态加载的图片从Flickr到一定的标签被点击时,网页...

As a relative beginner, I am wondering if anyone can help me better understand the methodology whereby dynamic content would be incorporated into DocPad...? e.g. AJAX, and dynamic server-side scripts for doing things like dynamically loading pictures from Flickr into a webpage when a certain tag is clicked...

感谢。

推荐答案

因此​​,有几个方法DocPad便于动态内容:

So there's a few ways DocPad facilitates dynamic content:

  1. 通过 regenerateEvery 配置选项。这将重新生成您的网站每隔一段时间指定。这个伟大的如 feedr 插件从远程提要源数据拉(如您最新的社交活动),以及何时合并 repocloner 它克隆出来,并保持一个Git仓库最新的项目里。这个方案的好处是它真的很容易做到的,并提供了一​​个动态网站的错觉。比如本杰明·勒普顿网站适用这种方法来保持它的主页上的统计数据,以及社会数据在侧边栏是最新的。每隔一小时就与再生的最新信息。使其快速,也illusively动态。

  1. Via the regenerateEvery configuration option. This will regenerate your website every so often you specify. This great when combined with plugins like feedr for pulling in data from remote feed sources (like your latest social activity), as well as repocloner which clones out and keeps a git repository up to date inside your project. The benefit of this option is it's really easy to do and provides the illusion of a dynamic website. For instance the Benjamin Lupton Website applies this method to keep it's statistics on the home page, as well as the social data in the sidebar up to date. Every hour it regenerates with the latest information. Making it fast, and also illusively dynamic.

通过动态 元数据属性 。当设置为以这告诉DocPad服务器,我们应该重新使该文件对每个请求,而不是只一次。这在的KitchenSink骨架里面<一个伟大工程href="https://github.com/docpad/kitchensink.docpad/blob/master/src/documents/search.html.coffee">search页面和<一href="https://github.com/docpad/kitchensink.docpad/blob/master/src/documents/nifties/dynamic.html.coffee">misc形式的。这种方法是最相似的PHP开发。

Via the dynamic meta-data property. When set to to true this tells the DocPad server we should re-render that document on each request, rather than just once. This works great inside the Kitchensink Skeleton for search pages and misc forms. This way is most similar to PHP development.

通过 serverExtend 事件。该事件可挂接到并延长DocPad服务器,允许您添加额外的服务器端逻辑,处理等常见的用例就是额外的路由添加到您的服务器来处理路线别名,添加表格处理,如接触形成,或添加RESTULful接口用于Backbone.js的应用。该 DocPad网站使用这个来的add额外的布线和再生后收到钩的文档。该 NodeChat骷髅使用这个来的add的Socket.io服务器端逻辑

Via the serverExtend event. This event allows you to hook into and extend the DocPad server, allowing you to add extra server-side logic, handling, etc. Common use cases is to add extra routing to your server to handle route aliases, adding form processing such as a contact form, or to add a RESTULful interface for a Backbone.js application. The DocPad Website uses this to add extra routing and a regenerate post-receive hook for the documentation. The NodeChat Skeleton uses this to add the Socket.io server-side logic.

通过在 API 。这种方式是最复杂,但可以说是相当有益的,如果你只是想为DocPad是一个现有的Node.js应用的一小部分。有了这个,你可以创建你的code进行DocPad实例,并与之交互。该咕噜-文档咕噜任务,利用这样的:)

Via the API. This way is the most involved but can be quite rewarding if you just wish for DocPad to be a small part of an existing node.js application. With this, you can create a DocPad instance in your code and interact with it. The grunt-docs grunt task utilises this :)

这篇关于静态与在docpad系统动态内容 - 如何创建动态内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆