by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
evilangel-ru
@evilangel-ru
Could you explain how to do it?
Gonzalo Peña-Castellanos
@goanpeca
{% set var1 = this.count | int %}
{% set var2 = var1 / 10 %}

{{ var2 }}
evilangel-ru
@evilangel-ru
I think I've tried something like that, give me a minute to check
evilangel-ru
@evilangel-ru
Hmm... It works now, I've tried to do this conversion, but may I did something wrong. Anycase - thanks a lot for you help
Gonzalo Peña-Castellanos
@goanpeca
:+1:
evilangel-ru
@evilangel-ru
I save simple code snipet to github, it shows how to match noun with number. It's not a part of English, but important for Russian, so on I wrote doc only in Russian. But may be it will useful for somebody else.
evilangel-ru
@evilangel-ru
It's me again :) I'm not sure that is a real problem, but it looks weird. When I use field name without underscore and put jinja expression in - it works. But if I use the name with an underscore - I have a string with jinja expression in a result html. For example:
In model file:
[fields.bcount]
label = bins_count
type = string

and in content.lr
bcount: {{ bag('tst_bag.test.count') }} 
--- 
body:  {{ this.bcount }}
It works, I have the value from databag. But in this case - I have the same string in the result page.
In model file:
[fields.b_count]
label = bins_count
type = string

and in content.lr
b_count: {{ bag('tst_bag.test.count') }}
---
body:  {{ this.bcount }}
evilangel-ru
@evilangel-ru
No, it doesn't relayted with underscore
evilangel-ru
@evilangel-ru
It looks even weirder. If I use field name 'count' - it's ok, I have the value from the databag, if any other - I have Jinja expression string. But if I put in model file field with name 'count', I can use names like 'bcount', 'ccount', and so on, but not 'cccount'. Could you advise if this a problem with jinja content plugin? Or Lektor template system? Should I open an issue for that?
Zekirdek IRC Network
@yebeabi_twitter
hello
Arky
@arky
Is it possible embedded slide decks in Lektor similar to Marp or ReMark tools?
Gonzalo Peña-Castellanos
@goanpeca
Sure, you can embed any html/js in lektor
you would need to have the jinja template set any html needed and you could pass the slide URL ID (I assume) values from the lektor models
Arky
@arky
@goanpeca Thanks, I am wondering if Lektor itself has some functionality built-in. Looking at the docs the slideshow feature on the main lektor comes closest
Gonzalo Peña-Castellanos
@goanpeca
you mean like havng a builtin “slide” model?
Not at the moment
It should be pretty easy to create. You could use flowdocks as items per slide, if the idea is to create slides as models.
Arky
@arky
@goanpeca Thanks, I'll learn about flowdocks. I'll need to embedded a couple of dozen slidedecks, so looking for a solution to create slides as models in lektor.
Not mention localization of slides in multiple languages, it could get out control pretty quickly without a good plan :D
Gonzalo Peña-Castellanos
@goanpeca

so looking for a solution to create slides as models in lektor.

Yes, the I would suggest you create a model called slide-deckwhicch can define some fields, and one of these fields would be a flowblockmodel called maybe slide, and then just make sure that flowdock has whatever fields you need. like title and content, and the content could be plain test or html so it does not get transformed into anything else (that would be done by remark)

something like that could work and provide also localization

Arky
@arky
Thanks @goanpeca You have been very helpful!
Kudos
Gonzalo Peña-Castellanos
@goanpeca
Glad to be of help
It could be an interesting project to share with others, so you could consider shating it over here
Michael Vartanyan
@mvartanyan
In case anyone looked for a visual editor for markdown fields in Lektor https://github.com/sphericalpm/lektor-simplemde
Gonzalo Peña-Castellanos
@goanpeca
Yes, we should add this to the lektor plugins website
Also it would really help to add a scrennshot of how it looks in the lektor Admin
Otherwise users are not sure what to expect
Are you the dev @mvartanyan ?
Michael Vartanyan
@mvartanyan
Are you the dev @mvartanyan ?
@apatrushev, a colleague of mine.
Gonzalo Peña-Castellanos
@goanpeca
Got it!
Arky
@arky
@goanpeca Sounds like a plan. It is a very large human impact project, once completed and deployed I'll file a bug for its inclusion in Lektor showcase.
1 reply
Andrea
@andrearicci
Hi, I love lektor but I don't see updates since a long time. Is the project active? Thank you
Gonzalo Peña-Castellanos
@goanpeca
Hi @andrearicci the core maintainers have reorganized a bit in the past few weeks and we are working to keep Lektor going and going strong.
A new release is planned to be released in a couple of weeks, so yes the project is active :-)
Andrea
@andrearicci
@goanpeca great news! thank you
Gonzalo Peña-Castellanos
@goanpeca
:+1:
Mountain/\Ash
@mountainash_twitter

Hello Lektor lovers - I've been working for hours today to get out 3 language/Alternatives site to output a valid variant sitemap.xml - it would be great if some of the Lektor experts could take a look at it (I put the code in the comments on the Lekor website Sitemap Guide):
http://disq.us/p/298xftx

I found that it's not easy to find out when a "virtual" page is being generated - aka a page that doesn't have a contents+xx.html file. Have I missed something with an attribute?

?
This might help
Mountain/\Ash
@mountainash_twitter
Not really - that's basically the one from the example (pretty basic). It only does one language/alternative (the alternative that it's requested in) and no alternative hreflang. I'll put the code in here for you to see what I mean:
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
{%- for alt in get_alts() %}
{%- set root = site.get('/', alt=alt) %}
   {%- for page in root.children if (page._source_alt == page._alt) or (page._source_alt == '_primary' and page._alt == {{ YOUR-PRIMARY-LOCALE }}) recursive %}
      <url>
      {# Very handy for debugging: {{page._source_alt}} | {{page._alt}} -#}
      <loc>{{ YOUR-HOST }}{{ page|url(absolute=True) }}</loc>
      {%- for hreflang in get_alts(page) if page.is_visible %}
      <xhtml:link rel="alternate" hreflang="{{ hreflang }}" href="{{ YOUR-HOST }}{{ page._path|url(alt=hreflang,absolute=True) }}"/>
      {%- endfor %}
      </url>
   {{- loop(page.children) }}
   {%- endfor %}
{%- endfor %}
</urlset>
Is there a way to get {{ YOUR-HOST }}? I'm currently using lektor-envvars to pass it in on build.
Also, Is there a way to get {{ YOUR-PRIMARY-LOCALE }} - I'm getting this manually in the xml.
Andrea
@andrearicci
hallo, can anyone help me to implement an automatic "last saved date" that updates when building? I've no idea where to start. Thank you
Andrea
@andrearicci
I found this that can be helpful https://pypi.org/project/jinja2-time/ but donnow how to use it
Pcoder
@pcoder
Hi, wonder if it is possible to disable subpages of a page altogether ?