mbutterick / pollen-users

please use https://forums.matthewbutterick.com/c/typesetting/ instead
https://forums.matthewbutterick.com/c/typesetting/
52 stars 0 forks source link

Directory links from pollen files #72

Open jnboehm opened 3 years ago

jnboehm commented 3 years ago

Most blog engines form links from blog posts routing to a directory (i. e. example.com/post/my-title/), whereas pollen has a titled html file as the result (so example.com/post/my-title.html). Has there been effforts or thoughts on creating canonical links in a similar vein as the first example with pollen?

I personally prefer that option as it keeps the result language agnostic, despite serving the same html file content (some supporting blog posts).

The approach taken for this would essentially boil down to creating the directory in question and generating the html file there (like example.com/post/my-title/index.html). This would change the meaning of a .poly.pm or .html.pm file so that would also be an argument against this behavior.

mbutterick commented 3 years ago

Has there been effforts or thoughts on creating canonical links in a similar vein as the first example with pollen?

No, because this* is a form of magic performed by a web server, and Pollen has a strong policy against magical thinking. In any case, it seems unnecessary: why not write a link tag function that omits the trailing index.html for URLs inside the /post/ directory.

 * meaning, expanding a directory-terminated URL to include index.html **

** behavior that is itself subject to change by settings in the .htaccess file. For instance on beautifulracket.com, I use intro.html as the directory default rather than index.html (so that I can generate page navigation links that are the same as the filename)

jnboehm commented 3 years ago

Huh, interesting, I always assumed that it would be a default from the browser, never questioned it too much.

Thank you for clarifying the rationale behind it!

jnboehm commented 3 years ago

A follow-up question: do you (does anyone) have a good way to work around this in the light of the index.ptree file? Would it be safe to rename the .html extension to a trailing slash to indicate the directory?

mbutterick commented 3 years ago

I wouldn’t dissuade anyone from experimenting. Consider, however, that the pagetree also cooperates with raco pollen render ··· to render certain files on disk. For that reason, it usually makes sense for the pagetree to refer to local (output) file paths. If you don’t care about this aspect of things, hack away.