ajax - Static vs. dynamic content in docpad system - how to create dynamic content? -


docpad described being comparable other static site generators, described being "not limited static site generation".

i've been browsing docpad website , other documentation , haven't yet been able find seems explain how incorporate dynamic content, , types of limitations may involved?

as relative beginner, wondering if can me better understand methodology whereby dynamic content incorporated docpad...? e.g. ajax, , dynamic server-side scripts doing things dynamically loading pictures flickr webpage when tag clicked...

thanks.

so there's few ways docpad facilitates dynamic content:

  1. via regenerateevery configuration option. regenerate website every specify. great when combined plugins feedr pulling in data remote feed sources (like latest social activity), repocloner clones out , keeps git repository date inside project. benefit of option it's easy , provides illusion of dynamic website. instance benjamin lupton website applies method keep it's statistics on home page, social data in sidebar date. every hour regenerates latest information. making fast, , illusively dynamic.

  2. via dynamic meta-data property. when set to true tells docpad server should re-render document on each request, rather once. works great inside kitchensink skeleton search pages , misc forms. way similar php development.

  3. via serverextend event. event allows hook , extend docpad server, allowing add server-side logic, handling, etc. common use cases add routing server handle route aliases, adding form processing such contact form, or add restulful interface backbone.js application. docpad website uses add routing , regenerate post-receive hook documentation. nodechat skeleton uses add socket.io server-side logic.

  4. via api. way involved can quite rewarding if wish docpad small part of existing node.js application. this, can create docpad instance in code , interact it. grunt-docs grunt task utilises :)


Comments