-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use with hexo #1
Comments
Btw, providing an example theme written in |
Took a bit different approach..
|
The message says blog/themes/landscape/layout/index.ejs but I'm guessing that is/should-be blog/themes/landscape/layout/layout.twig . |
So I wanted to convert a Craft CMS website into a static website. A quick search on https://staticgen.com led me to Hexo, which mentions it supports Twig templating. It wasn't too clear at first, but it turns out it does support Twig when using the
hexo-renderer-twig
package, which is neat 👍npm install hexo-cli -g hexo init blog cd blog npm i --save hexo-renderer-twig
Now I replace the
index.ejs
template fromlandscape
theme with anindex.twig
with the following content:And it seems to be working well 🎉
Now trying a simple condition just as in your readme:
💥
Note: Above error is huge, but updating this project's twig version to more recent version
Lead to a smaller error :P
Okay so the twig example is just wrong, twig can use ternary operators, but not with the
if
statement, let's write this in a different way:There you go
Now let's try to use twig for a page
Nuke everything from theme's layout folder and have this:
blog/themes/landscape/layout/index.ejs
blog/themes/landscape/layout/index.twig
result:
🔥 Should have been the following output:
😢 So looks like the twig's
block
is failing here (or am-I doing it wrong?), what's going on? Even trying with no twig inindex.twig
or doing the same with ablog.twig
does the same. Or is this anhexo
issue? I think I'm lost 🗺I know blocks in twig.js were rewritten here as they were a bit broken:
twigjs/twig.js#625
But even when using it with twig dependency being updated (see my fork) and #2 , I'm not able to get my theme to use
block
statements. I think I'll just go back to jekyll for now and convert thattwig
code intoLiquid
If someone passes by and knows the answer, I'm curious to know what's wrong anyway.
The text was updated successfully, but these errors were encountered: