I have recently discovered Zola and Tera (Rust frameworks for statically-generated websites) and found them amazing.
I'm trying to filter specific category pages to display in a section on the same page. To illustrate, I wrote some code like…
I've found out you can use
{% set posts = get_taxonomy(kind="posts") %}
to retrieve a taxonomy but I'm clueless how to iterate over the terms of the taxonomy in for example single.html of this taxonomy.
I tried things like the following, but I…
I have a rust application (https://github.com/Riduidel/rrss2imap) which, when run on my raspberry, fails with the following error message
pi@raspberrypi-server:~/rrss2imap $ ./rrss2imap-armv7-unknown-linux-gnueabihf-debug run
[2019-09-02…
I tried the following, which I found in the Zola documentation but it didn't render anything. The Tera docs weren't rewarding either.
{% for post in section.pages %}
I'm studying rust/actix/tera and cannot figure out how to implement ResponseError trait on the tera::Error, or alternatively how to convert tera::Error to actix_web::Error.
With the following code snippet:
match TEMPLATES.render("index.html", &ctx)…
I'm studying rust/actix/tera and cannot figure out how may I return a custom tera error string in the actix output.
Here's my code:
use actix_web::{App, get, error, Error, HttpResponse, HttpServer};
use tera::{Tera, Context};
use…
I have a Tera (Jinja2 alike) template which requires 2 functions to be imported. Raises expected function that takes 2 arguments. How do I approach this?
One of the functions:
#[derive(Serialize)]
#[derive(Debug)]
enum Color {
White,
Blue,
…
I'm thinking of publishing a photography blog.
Normally, a Static Site Generator generates the site pages based on .MD files and the linked images placed in an assets directory.
I'm looking for a Static Site Generator which can generated all the…
I am using tera and want to make a CLI that acts as a new project generator (think rails scaffold). There will be quite a few templates and I would like to ship them in my crate as an asset file and read from disk instead of using include_str! and…
I am experimenting with building a web app in Rust using Tera and there is a panic every time on the render() call below. Example of the chunk of code:
async fn login(tera: web::Data) -> impl Responder {
let mut data = Context::new();
…
I am currently re-writing a web application built in python/flask that uses flashes as so:
{% with flashes = get_flashed_messages() %}
{% if flashes %}
I am stuck in a simple problem but not able to figure it. I am not sure if this is the right place to ask the question on a package in Rust.
Most of the time, in the template, we will want to transform our data. For example, I wanted to concat n…
I tried to make actix-web and Tera work together, from examples I found online.
This is my code:
use actix_web::{get, web, Result, App, HttpServer, HttpRequest, Responder, HttpResponse};
use serde::{Deserialize,Serialize};
use tera::{Tera,…
The problem
I'm new to Zola and its templating engine Tera, and I'm struggling with making my own Zola theme easily localizable, even providing some out-of-the-box translations for e.g. English and German. Zolas's fluent integration is not there yet…
I have the following code in Rust using tera template language:
let mut context = Context::new();
context.insert("adminform", &admin_form);
let html = match tera.render("change_form.html", &context) {
Ok(html) => html,
…