On Thu, 20 Oct 2022 at 09:19, Maxime Garnier <[email protected]> wrote: > > For more context, what I envision for card.tmpl would be something like > > <div class="card" style="justify-content: center"> > <img src="/images/${image_path}.jpg" alt="Jane" class="im-center" > style="width:50%"> > <div class="container"> > <h2> ${name} Doe</h2> > <p class="title">CEO </p> > <p>Some text that describes me lorem ipsum ipsum lorem.</p> > <!-- some way to upload text from a file? with %{content_path} --> > <p>[email protected]</p> > <p><button class="button">Contact</button></p> > </div> > </div> > > which would be called in my main html by > {{% card name=Maxime image_path=me content_path=/files/location/me.txt %}} > > Would something close to that be possible ? > > Thanks!
If you want to read a file from within the template, you could write a simple Python function for that and expose it in the global context in conf.py - but note this will not track dependencies correctly. If you want dependencies to be tracked, you need a custom shortcode plugin. Another route might be to slightly abuse the post-list mechanism: every person gets their own page, and the post-list shows them (including metadata and post content). A third option would be server-side includes, but those are pretty silly IMO. -- Chris Warrick <https://chriswarrick.com/> PGP: 5EAAEA16 -- You received this message because you are subscribed to the Google Groups "nikola-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/CAMw%2Bj7JAC%2BZxOk_HCFCK6nMuVdn7Dce7CR22f6rnUFY7mHnrJg%40mail.gmail.com.
