Re: How to include global HTML attributes in posts in Haunt Static Site Generator
Tomas Volf <[email protected]>
| Newsgroups | gmane.lisp.guile.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, Pon Arun Kumar R <[email protected]> writes: > Objective: To include additional metadata in the post content file in > markdown. For example: lang : en-US translate="Yes" when added to the post > markdown content file, the expected rendering of the html of the blog post > content is <div lang="en-US" translate="Yes">.....content of the blog > post.....</div> > > Example: myfirstblogpost.md > title: my first blog post > author: guile haunt user > tags: haunt, guile > lang: en-US > translate: yes > --- > Sample blog post content that is expected to be in the mentioned language > as referenced in the metadata above as lang: en-US and also provides > additional attribute of translate: yes. so once built and served by haunt, > the expected html of the blog post is expected to include <div lang="en-US" > translate="yes"> Sample blog post content that is ......</div> > > Questions: > 1. Which module in haunt needs to be modified? is it the module where the > metadata key value pairs are passed on to render the html? I do not think there is anything in haunt that you need to modify. You can just add your extra metadata and access the full alist using post-metadata procedure. You can even define additional accessors in your own code as: --8<---------------cut here---------------start------------->8--- (define (post-metadata-lang post) (assq-ref (post-metadata post) 'lang)) --8<---------------cut here---------------end--------------->8--- > 2. How to code and extend so that the global attributes, local attributes > and HTML5 elements are supported with(in) haunt posts? You can just modify your theme, in particular the procedure passed to #:post-template argument, to inspect the post-metadata and adjust the generated HTML based on your requirements. Tomas -- There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.
signature.asc
(application/pgp-signature, 853 B)
-----BEGIN PGP SIGNATURE----- iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmfcjW8OHH5Ad29sZnNk ZW4uY3oACgkQL7/ufbZ/walbIg/+PGJkaw3RmQ3p7K42yZF7V3JW8dqGs4ERpIYI 0iGhwKL/M757ABNvehcGR2ni21edi0/CzG7S8zvlj6QMOsKJgL1KKq2GbBRrVh7o CWgodVFXYDhwdTwoCt1Ou01v7uafY9sCoCIghFRs3yfwkwzCZvHGtbtR3Lg71DId I5HV34F2Rkuh50t0TISN5zUh8BsZUfve2NufPmdMo8ASeeGDypiI38sqPgUQEIlY 6Ef4QvfeOAim8Ptx6lYRm0oFmhEzPNLWaqDKbuQbbwG3DRa2ZjzvEFndAmSoUpM2 lsJ9pVLguQbNBP0PWgbMlJJWbFHRzdQ4JrSJQwHFk6cVCjroAnMoqCbrKTDVT5qA O+lsYObDbB4r5iohQCmSvt/6G78Xep9tY7du3vuI6SgU9fHcyprX9dF/wzpOmX6Z mRuQW5xqSl8G4jIHCp4QMeBpHJRChF/C8eiNwYB3gQFZKZmHBeNE24xHjm56K9OV ngnyXJ+FYKm7qL6sGxamWebIT/zw65dCps/XecQJmzmjJrgjOAWEeeesMy8W5mjC 9NezIUEtCvbtCQN3glz1dVRnwk/Y0fFyQfFLVGm4oobn5XVboEzy6Qo2vdw4nJ9q A30bDvIOE/GewJ958JeQfnZ/hxKC8imSdAtMnWfn1kIrUJozmFwE1p1rEF9B1CR2 131jn34= =7rlq -----END PGP SIGNATURE-----