Re: "pybloxsom"??
seanh <[email protected]> Wed, 23 Feb 2011 20:20:52 +0000
| Newsgroups | gmane.comp.web.pyblosxom.user |
|---|---|
| Message-ID | <20110223202052.GE3362@kisimul> |
On Wed, Feb 23, 2011 at 07:45:49PM +0000, seanh wrote: > What I'd suggest is that each file in a flavour directory corresponds to > a URL: > > myflavour/ > index.jinja > archive.jinja > some_other_page.jinja > post.jinja > category.jinja > year.jinja > month.jinja > > You can put whatever template files you want in the flavour, they don't > have to be head, foot and story, etc. If a visitor requests the root URL > then index.jinja will be rendered, and it might render the most recent > posts, or do whatever the template code inside index.jinja wants to do. > If the /archive URL is requested them archive.jinja would be rendered, > and so on. > > post, category, year and month would be treated specially by pyblosxom. > For example, if a post permalink URL like /posts/my-blog-post is > requested then post.jinja would be rendered, and pyblosxom would pass > the requested entry object corresponding to my-blog-post to the template > code so it knows which post is being requested. Similarly, > category.jinja woud be called to render category URLs and passed the > name of the requested category, and so on. > > So although flavours are not restricted to a set of mandatory template > files like head, foot, story etc. and can define whatever URLs they > want, some URLs/template files are treated specially by pyblosxom. Wait! This is dumb. The pyblosxom core should just have a simple algorithm to decide which template file to render based on the URL requested, then it should render the template code passing the requested URL into it. User requests /foo, /foo.jinja template is rendered and the URL request "/foo" is passed to the template code as argument. Users requests /foo/bar, /foo.jinja template is rendered and "/foo/bar" is the argument. Unless the flavourdir actually contains a subdir foo with a bar.jinja template in it, in which case that template file would be rendered instead. So for example a year.jinja template would get rendered for a URL like /year/2011. The template code inside year.jinja could parse the "/year/2011" string it gets as its argument and make a request to pyblosom for all entries from 2011 and render them. So pyblosxom core would know nothing about front page, archive page, permalink page, category page etc templates. It only knows that there are template files, it has an algorithm for deciding which template file to render based on the requested URL, and it passes the URL string into the template code. But this breaks the current feature where the path to the file for an entry is the permalink URL to that entry. Would be fun to work on a plugin. I'll add it to my list of things to maybe do in the future. ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev