Synchronized build

This commit is contained in:
Lektor Bot 2023-01-02 02:39:06 +00:00
parent d2bf6c75f8
commit 57615a380d
72 changed files with 801 additions and 801 deletions

View File

@ -197,8 +197,8 @@ which can for instance be used with the <a href="../templates/filters/tojson/" c
filter.</p> filter.</p>
<h2 id="example-databag">Example Databag</h2><p>This is a basic example of a data bag that contains configuration values <h2 id="example-databag">Example Databag</h2><p>This is a basic example of a data bag that contains configuration values
for google maps. It's stored in <code>databags/gmaps.ini</code>:</p> for google maps. It's stored in <code>databags/gmaps.ini</code>:</p>
<div class="hll"><pre><span></span><span class="na">key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1233456ABCDEFG</span><span class="w"></span> <div class="hll"><pre><span></span><span class="na">key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1233456ABCDEFG</span>
<span class="na">api_url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://www.google.com/maps/embed/v1/</span><span class="w"></span> <span class="na">api_url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://www.google.com/maps/embed/v1/</span>
</pre></div> </pre></div>
<p>This can then be usde to good effect in templates:</p> <p>This can then be usde to good effect in templates:</p>
<div class="hll"><pre><span></span><span class="cp">{%</span> <span class="k">macro</span> <span class="nv">render_map</span><span class="o">(</span><span class="nv">location</span><span class="o">,</span> <span class="nv">width</span><span class="o">=</span><span class="m">600</span><span class="o">,</span> <span class="nv">height</span><span class="o">=</span><span class="m">450</span><span class="o">)</span> <span class="cp">%}</span> <div class="hll"><pre><span></span><span class="cp">{%</span> <span class="k">macro</span> <span class="nv">render_map</span><span class="o">(</span><span class="nv">location</span><span class="o">,</span> <span class="nv">width</span><span class="o">=</span><span class="m">600</span><span class="o">,</span> <span class="nv">height</span><span class="o">=</span><span class="m">450</span><span class="o">)</span> <span class="cp">%}</span>

View File

@ -237,11 +237,11 @@
<p>Returns a <code>set</code> with all values for <code>field_name</code> of all <p>Returns a <code>set</code> with all values for <code>field_name</code> of all
<a href="../../record/" class="ref">Records</a> in this query.</p> <a href="../../record/" class="ref">Records</a> in this query.</p>
<h2 id="example">Example</h2><p>If your blog posts have a field called <code>tags</code>:</p> <h2 id="example">Example</h2><p>If your blog posts have a field called <code>tags</code>:</p>
<div class="hll"><pre><span></span><span class="c1"># blog-post.ini</span><span class="w"></span> <div class="hll"><pre><span></span><span class="c1"># blog-post.ini</span>
<span class="k">[field.tags]</span><span class="w"></span> <span class="k">[field.tags]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Tags</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Tags</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">strings</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">strings</span>
</pre></div> </pre></div>
<p>You can display all your blog posts' tags with:</p> <p>You can display all your blog posts' tags with:</p>
<div class="hll"><pre><span></span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">tags</span> <span class="o">=</span> <span class="nv">site.query</span><span class="o">(</span><span class="s1">&#39;/blog&#39;</span><span class="o">)</span><span class="nv">.distinct</span><span class="o">(</span><span class="s1">&#39;tags&#39;</span><span class="o">)</span> <span class="cp">%}</span> <div class="hll"><pre><span></span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">tags</span> <span class="o">=</span> <span class="nv">site.query</span><span class="o">(</span><span class="s1">&#39;/blog&#39;</span><span class="o">)</span><span class="nv">.distinct</span><span class="o">(</span><span class="s1">&#39;tags&#39;</span><span class="o">)</span> <span class="cp">%}</span>

View File

@ -264,11 +264,11 @@ It's most useful for representing flags that can be enabled or disabled.</p>
</table> </table>
<p>The <code>checkbox_label</code> attribute can be used to give a description to the <p>The <code>checkbox_label</code> attribute can be used to give a description to the
checkbox which otherwise looks a little bit lonely in the admin panel.</p> checkbox which otherwise looks a little bit lonely in the admin panel.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.render_big]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.render_big]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Render big</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Render big</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">boolean</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">boolean</span>
<span class="na">checkbox_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">If true, then the page will be rendered larger.</span><span class="w"></span> <span class="na">checkbox_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">If true, then the page will be rendered larger.</span>
<span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span><span class="w"></span> <span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">false</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;page</span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">this.render_big</span> <span class="cp">%}</span><span class="s"> page-large</span><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;page</span><span class="cp">{%</span> <span class="k">if</span> <span class="nv">this.render_big</span> <span class="cp">%}</span><span class="s"> page-large</span><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="s">&quot;</span><span class="p">&gt;</span>
... ...

View File

@ -258,11 +258,11 @@ default which means that the record's configured title will be used as
label.</li> label.</li>
</ul> </ul>
<p>In the contents file the values are stored as comma separated list.</p> <p>In the contents file the values are stored as comma separated list.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.slideshow]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.slideshow]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Slideshow</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Slideshow</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">checkboxes</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">checkboxes</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Attached images to include in the slidehow</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Attached images to include in the slidehow</span>
<span class="na">source</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">record.attachments.images</span><span class="w"></span> <span class="na">source</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">record.attachments.images</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">image</span> <span class="k">in</span> <span class="nv">this.attachments.images</span> <span class="cp">%}</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="cp">{%</span> <span class="k">for</span> <span class="nv">image</span> <span class="k">in</span> <span class="nv">this.attachments.images</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">if</span> <span class="nv">image._id</span> <span class="k">in</span> <span class="nv">this.slideshow</span> <span class="cp">%}</span> <span class="cp">{%</span> <span class="k">if</span> <span class="nv">image._id</span> <span class="k">in</span> <span class="nv">this.slideshow</span> <span class="cp">%}</span>

View File

@ -241,9 +241,9 @@
than a plain old <code>string</code> some basic operations can be provided in the than a plain old <code>string</code> some basic operations can be provided in the
templates.</p> templates.</p>
<p>The canonical format for the type in text form is <code>YYYY-MM-DD</code>.</p> <p>The canonical format for the type in text form is <code>YYYY-MM-DD</code>.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.pub_date]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.pub_date]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Publication date</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Publication date</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">date</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">date</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Published: <span class="cp">{{</span> <span class="nv">this.pub_date.strftime</span><span class="o">(</span><span class="s1">&#39;%d/%m/%Y&#39;</span><span class="o">)</span> <span class="cp">}}</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Published: <span class="cp">{{</span> <span class="nv">this.pub_date.strftime</span><span class="o">(</span><span class="s1">&#39;%d/%m/%Y&#39;</span><span class="o">)</span> <span class="cp">}}</span>
</pre></div> </pre></div>

View File

@ -271,9 +271,9 @@ or
pub_date: 2016-01-13 07:53:22 +0900 pub_date: 2016-01-13 07:53:22 +0900
</code></pre> </code></pre>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.pub_date]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.pub_date]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Publication date</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Publication date</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">datetime</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">datetime</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Published: <span class="cp">{{</span> <span class="nv">this.pub_date.strftime</span><span class="o">(</span><span class="s1">&#39;%Y-%m-%d %H:%M:%S&#39;</span><span class="o">)</span> <span class="cp">}}</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">p</span><span class="p">&gt;</span>Published: <span class="cp">{{</span> <span class="nv">this.pub_date.strftime</span><span class="o">(</span><span class="s1">&#39;%Y-%m-%d %H:%M:%S&#39;</span><span class="o">)</span> <span class="cp">}}</span>
</pre></div> </pre></div>

View File

@ -239,11 +239,11 @@
<p>The <code>float</code> type is similar to the <a href="../integer/" class="ref">integer</a> one but it <p>The <code>float</code> type is similar to the <a href="../integer/" class="ref">integer</a> one but it
can store floating points instead of just integer values.</p> can store floating points instead of just integer values.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.percentage]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.percentage]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Percentage</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Percentage</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">float</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">float</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Just a percentage of a progress bar.</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Just a percentage of a progress bar.</span>
<span class="na">addon_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">%</span><span class="w"></span> <span class="na">addon_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">%</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;progress-bar&quot;</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;progress-bar&quot;</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;progress&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;width: </span><span class="cp">{{</span> <span class="nv">this.percentage</span> <span class="cp">}}</span><span class="s">%&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">span</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;progress&quot;</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;width: </span><span class="cp">{{</span> <span class="nv">this.percentage</span> <span class="cp">}}</span><span class="s">%&quot;</span><span class="p">&gt;&lt;/</span><span class="nt">span</span><span class="p">&gt;</span>

View File

@ -267,10 +267,10 @@ field-2: value 2
within it, but the blocks can be individually accessed through the within it, but the blocks can be individually accessed through the
<code>blocks</code> attribute. Each block's attributes are the individual fields which <code>blocks</code> attribute. Each block's attributes are the individual fields which
you are free to access if so desired.</p> you are free to access if so desired.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.body]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">flow</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">flow</span>
<span class="na">flow_blocks</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">text, image</span><span class="w"></span> <span class="na">flow_blocks</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">text, image</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;body&quot;</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;body&quot;</span><span class="p">&gt;</span>
<span class="cp">{{</span> <span class="nv">this.body</span> <span class="cp">}}</span> <span class="cp">{{</span> <span class="nv">this.body</span> <span class="cp">}}</span>

View File

@ -240,10 +240,10 @@
<p>The <code>html</code> type is basically the same as the <a href="../text/" class="ref">text</a> type but <p>The <code>html</code> type is basically the same as the <a href="../text/" class="ref">text</a> type but
in templates it's rendered directly as HTML instead of being escaped.</p> in templates it's rendered directly as HTML instead of being escaped.</p>
<p>It renders as a multi-line input field in the admin interface.</p> <p>It renders as a multi-line input field in the admin interface.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.tracking_code]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.tracking_code]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Tracking Code</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Tracking Code</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">raw HTML that is inserted for ad tracking purposes.</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">raw HTML that is inserted for ad tracking purposes.</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">html</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">html</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="cp">{{</span> <span class="nv">this.tracking_code</span> <span class="cp">}}</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="cp">{{</span> <span class="nv">this.tracking_code</span> <span class="cp">}}</span>
</pre></div> </pre></div>

View File

@ -241,11 +241,11 @@
arbitrary natural numbers both negative and positive. It should be used arbitrary natural numbers both negative and positive. It should be used
instead of a string when a real number with such behavior is wanted as it instead of a string when a real number with such behavior is wanted as it
sorts numbers correctly and the numbers can be manipulated.</p> sorts numbers correctly and the numbers can be manipulated.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.image_width]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.image_width]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Image width</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Image width</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">integer</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">integer</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">The intended image width in pixels.</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">The intended image width in pixels.</span>
<span class="na">addon_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">px</span><span class="w"></span> <span class="na">addon_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">px</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">img</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">img</span>
<span class="na">src</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">this.image.thumbnail</span><span class="o">(</span><span class="nv">this.image_width</span> <span class="o">-</span> <span class="m">10</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span> <span class="na">src</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">this.image.thumbnail</span><span class="o">(</span><span class="nv">this.image_width</span> <span class="o">-</span> <span class="m">10</span><span class="o">)</span> <span class="cp">}}</span><span class="s">&quot;</span>

View File

@ -265,9 +265,9 @@ there are some special attributes on it to access more information:</p>
</tbody> </tbody>
</table> </table>
<p>Additional attributes can become available through the use of plugins.</p> <p>Additional attributes can become available through the use of plugins.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.body]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;body&quot;</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;body&quot;</span><span class="p">&gt;</span>
<span class="cp">{{</span> <span class="nv">this.body</span> <span class="cp">}}</span> <span class="cp">{{</span> <span class="nv">this.body</span> <span class="cp">}}</span>
@ -297,10 +297,10 @@ include an explicit <em>scheme</em> or <em>netloc</em>.</p>
<p>As an example, to force the old behavior, wherein links were never <p>As an example, to force the old behavior, wherein links were never
resolved via the Lektor database, configure a <code>markdown</code> field like resolved via the Lektor database, configure a <code>markdown</code> field like
so:</p> so:</p>
<div class="hll"><pre><span></span><span class="k">[fields.body]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
<span class="na">resolve_links</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">never</span><span class="w"></span> <span class="na">resolve_links</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">never</span>
</pre></div> </pre></div>
<h2 id="linking-to-a-specific-alt">Linking to a Specific Alt</h2><p>When links are resolved through the Lektor database, URLs to specific _alt_s may be obtained by adding an <code>alt</code> query arg to the link. <h2 id="linking-to-a-specific-alt">Linking to a Specific Alt</h2><p>When links are resolved through the Lektor database, URLs to specific _alt_s may be obtained by adding an <code>alt</code> query arg to the link.
For example, to link to the current page, but in the French alt:</p> For example, to link to the current page, but in the French alt:</p>

View File

@ -241,11 +241,11 @@
but unlike it you can only select a single item. For configuration options but unlike it you can only select a single item. For configuration options
refer directly to the checkboxes type.</p> refer directly to the checkboxes type.</p>
<p>In the contents file the values are stored as a single textual item.</p> <p>In the contents file the values are stored as a single textual item.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.class]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.class]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Class</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Class</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">select</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">select</span>
<span class="na">choices</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">full-width, pull-left, pull-right</span><span class="w"></span> <span class="na">choices</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">full-width, pull-left, pull-right</span>
<span class="na">choice_labels</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Full Width, Pull Left, Pull Right</span><span class="w"></span> <span class="na">choice_labels</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Full Width, Pull Left, Pull Right</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">this.class</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">this.class</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span>
... ...

View File

@ -240,9 +240,9 @@ basic ones in Lektor. It can store arbitrary natural numbers both negative and
positive. It's intended for giving pages a sort order. The reason it's a positive. It's intended for giving pages a sort order. The reason it's a
special type is that future versions of Lektor can take advantage of this to special type is that future versions of Lektor can take advantage of this to
implement a widget for ordering.</p> implement a widget for ordering.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.sort_key]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.sort_key]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Sort order</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Sort order</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">sort_key</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">sort_key</span>
</pre></div> </pre></div>

View File

@ -241,12 +241,12 @@
arbitrary text. It's useful for many places where you want to show a bit of arbitrary text. It's useful for many places where you want to show a bit of
text without any special formatting (titles, basic summaries and more).</p> text without any special formatting (titles, basic summaries and more).</p>
<p>It renders as a basic input field in the admin interface.</p> <p>It renders as a basic input field in the admin interface.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.title]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.title]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="na">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">large</span><span class="w"></span> <span class="na">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">large</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">The title of the page</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">The title of the page</span>
<span class="na">addon_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">[[header]]</span><span class="w"></span> <span class="na">addon_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">[[header]]</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">this.title</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">h1</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">this.title</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">h1</span><span class="p">&gt;</span>
</pre></div> </pre></div>

View File

@ -242,10 +242,10 @@ and <a href="../text/" class="ref">text</a> type. It renders as a multi-line te
admin but the template will see each line of text separately. It's primarily admin but the template will see each line of text separately. It's primarily
useful for some advanced scenarios where enumerations and other things useful for some advanced scenarios where enumerations and other things
should be rendered.</p> should be rendered.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.things_to_buy]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.things_to_buy]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Things to buy</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Things to buy</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">strings</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">strings</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">A list of things that would be good to buy</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">A list of things that would be good to buy</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">h2</span><span class="p">&gt;</span>Shopping List<span class="p">&lt;/</span><span class="nt">h2</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">h2</span><span class="p">&gt;</span>Shopping List<span class="p">&lt;/</span><span class="nt">h2</span><span class="p">&gt;</span>
<span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="p">&lt;</span><span class="nt">ul</span><span class="p">&gt;</span>

View File

@ -241,9 +241,9 @@
can store multiple lines. It does not support any formatting but is very can store multiple lines. It does not support any formatting but is very
useful for storing code and other things.</p> useful for storing code and other things.</p>
<p>It renders as a multi-line input field in the admin interface.</p> <p>It renders as a multi-line input field in the admin interface.</p>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.code]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.code]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Code</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Code</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">text</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">text</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">pre</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">this.code</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">pre</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">pre</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">this.code</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">pre</span><span class="p">&gt;</span>
</pre></div> </pre></div>

View File

@ -288,9 +288,9 @@ other attributes that are useful:</p>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.website]</span><span class="w"></span> <h2 id="field-usage">Field Usage</h2><div class="hll"><pre><span></span><span class="k">[fields.website]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Website</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Website</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">url</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">url</span>
</pre></div> </pre></div>
<h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">this.url</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">this.url.host</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span> <h2 id="template-usage">Template Usage</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;</span><span class="cp">{{</span> <span class="nv">this.url</span> <span class="cp">}}</span><span class="s">&quot;</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">this.url.host</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
</pre></div> </pre></div>

View File

@ -231,7 +231,7 @@ into a new location.</p>
<span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">add_publisher</span><span class="p">(</span><span class="s1">&#39;copy&#39;</span><span class="p">,</span> <span class="n">CopyPublisher</span><span class="p">)</span> <span class="bp">self</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">add_publisher</span><span class="p">(</span><span class="s1">&#39;copy&#39;</span><span class="p">,</span> <span class="n">CopyPublisher</span><span class="p">)</span>
</pre></div> </pre></div>
<p>This publisher registers with the <code>copy</code> scheme and could be used like this:</p> <p>This publisher registers with the <code>copy</code> scheme and could be used like this:</p>
<div class="hll"><pre><span></span><span class="na">target_url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">copy:///path/to/destination/folder</span><span class="w"></span> <div class="hll"><pre><span></span><span class="na">target_url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">copy:///path/to/destination/folder</span>
</pre></div> </pre></div>

View File

@ -196,8 +196,8 @@ supported by JSON directly and the return value will be in a format that
allows safe embedding in HTML. However if you want to use this value in an allows safe embedding in HTML. However if you want to use this value in an
attribute of an element it needs to use single quotes otherwise it will attribute of an element it needs to use single quotes otherwise it will
generate a syntax error due to the embedded quotes.</p> generate a syntax error due to the embedded quotes.</p>
<h2 id="examples">Examples</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/javascript&quot;</span><span class="p">&gt;</span><span class="w"></span> <h2 id="examples">Examples</h2><div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">script</span> <span class="na">type</span><span class="o">=</span><span class="s">&quot;text/javascript&quot;</span><span class="p">&gt;</span>
<span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">options</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="cp">{{</span> <span class="o">{</span><span class="s1">&#39;foo&#39;</span><span class="o">:</span> <span class="s1">&#39;bar&#39;</span><span class="o">}|</span><span class="nf">tojson</span> <span class="cp">}}</span><span class="p">;</span><span class="w"></span> <span class="w"> </span><span class="kd">var</span><span class="w"> </span><span class="nx">options</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="cp">{{</span> <span class="o">{</span><span class="s1">&#39;foo&#39;</span><span class="o">:</span> <span class="s1">&#39;bar&#39;</span><span class="o">}|</span><span class="nf">tojson</span> <span class="cp">}}</span><span class="p">;</span>
<span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">script</span><span class="p">&gt;</span>
</pre></div> </pre></div>
<p>If used in attributes, single quotes are required:</p> <p>If used in attributes, single quotes are required:</p>

View File

@ -165,15 +165,15 @@ the system will refuse to build the website.</p></div><h2 id="enabling-alternati
section has to be added. It's important that one of the alternatives is section has to be added. It's important that one of the alternatives is
marked as "primary" which informs the system which of the alternatives is marked as "primary" which informs the system which of the alternatives is
the reference.</p> the reference.</p>
<div class="hll"><pre><span></span><span class="k">[alternatives.en]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[alternatives.en]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">English</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">English</span>
<span class="na">primary</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">primary</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">en_US</span><span class="w"></span> <span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">en_US</span>
<span class="k">[alternatives.fr]</span><span class="w"></span> <span class="k">[alternatives.fr]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">French</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">French</span>
<span class="na">url_prefix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/fr/</span><span class="w"></span> <span class="na">url_prefix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/fr/</span>
<span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">fr</span><span class="w"></span> <span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">fr</span>
</pre></div> </pre></div>
<p>The <code>locale</code> key is used to define the locale that Lektor assumes for the <p>The <code>locale</code> key is used to define the locale that Lektor assumes for the
alternative. This is for instance used for date formatting.</p> alternative. This is for instance used for date formatting.</p>

View File

@ -157,9 +157,9 @@ menu or similar things.</p>
folder. The files there are accessible by their name sans the file extension. folder. The files there are accessible by their name sans the file extension.
All ordering in the source files is retained. So for instance this could All ordering in the source files is retained. So for instance this could
be the <code>main-nav.ini</code> data file for a basic navigation:</p> be the <code>main-nav.ini</code> data file for a basic navigation:</p>
<div class="hll"><pre><span></span><span class="na">/downloads</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Download</span><span class="w"></span> <div class="hll"><pre><span></span><span class="na">/downloads</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Download</span>
<span class="na">/docs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation</span><span class="w"></span> <span class="na">/docs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation</span>
<span class="na">/blog</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog</span><span class="w"></span> <span class="na">/blog</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog</span>
</pre></div> </pre></div>
<p>And the template could access it like this:</p> <p>And the template could access it like this:</p>
<div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">ul</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;nav&quot;</span><span class="p">&gt;</span> <div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">ul</span> <span class="na">class</span><span class="o">=</span><span class="s">&quot;nav&quot;</span><span class="p">&gt;</span>
@ -178,14 +178,14 @@ within the bag. For instance you could use this to look up values that might
change depending on the alternative of a page for instance.</p> change depending on the alternative of a page for instance.</p>
<p>In this case the system is used to translate buttons. Take <code>buttons.ini</code> <p>In this case the system is used to translate buttons. Take <code>buttons.ini</code>
as an example:</p> as an example:</p>
<div class="hll"><pre><span></span><span class="k">[en]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[en]</span>
<span class="na">download</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Download</span><span class="w"></span> <span class="na">download</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Download</span>
<span class="k">[de]</span><span class="w"></span> <span class="k">[de]</span>
<span class="na">download</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Herunterladen</span><span class="w"></span> <span class="na">download</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Herunterladen</span>
<span class="k">[ru]</span><span class="w"></span> <span class="k">[ru]</span>
<span class="na">download</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Скачать</span><span class="w"></span> <span class="na">download</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Скачать</span>
</pre></div> </pre></div>
<p>And in a template it could be used like this:</p> <p>And in a template it could be used like this:</p>
<div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">h2</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">bag</span><span class="o">(</span><span class="s1">&#39;buttons&#39;</span><span class="o">,</span> <span class="nv">this.alt</span><span class="o">,</span> <span class="s1">&#39;download&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">h2</span><span class="p">&gt;</span> <div class="hll"><pre><span></span><span class="p">&lt;</span><span class="nt">h2</span><span class="p">&gt;</span><span class="cp">{{</span> <span class="nv">bag</span><span class="o">(</span><span class="s1">&#39;buttons&#39;</span><span class="o">,</span> <span class="nv">this.alt</span><span class="o">,</span> <span class="s1">&#39;download&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="p">&lt;/</span><span class="nt">h2</span><span class="p">&gt;</span>

View File

@ -163,8 +163,8 @@ and not very portable.</p>
<p>The system supports FTP (<code>ftp://</code>) and FTP over TLS (<code>ftps://</code>). Passive mode <p>The system supports FTP (<code>ftp://</code>) and FTP over TLS (<code>ftps://</code>). Passive mode
can be enabled/disabled with the optional <code>?passive</code> parameter. It defaults can be enabled/disabled with the optional <code>?passive</code> parameter. It defaults
to true.</p> to true.</p>
<h2 id="example">Example</h2><div class="hll"><pre><span></span><span class="k">[servers.production]</span><span class="w"></span> <h2 id="example">Example</h2><div class="hll"><pre><span></span><span class="k">[servers.production]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ftps://myuser:mypassword@ftp.example.com/var/www/example</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ftps://myuser:mypassword@ftp.example.com/var/www/example</span>
</pre></div> </pre></div>
<h2 id="credentials">Credentials</h2><p>FTP is considered a largely insecure protocol for Lektor. As such if you <h2 id="credentials">Credentials</h2><p>FTP is considered a largely insecure protocol for Lektor. As such if you
want to use it you should keep your project file safe as credentials will want to use it you should keep your project file safe as credentials will

View File

@ -163,8 +163,8 @@ can also accept <code>username:password@</code> in the URL to hold the credentia
addition to accepting username and password from the command line or addition to accepting username and password from the command line or
environment variables.</p> environment variables.</p>
<p>Example:</p> <p>Example:</p>
<div class="hll"><pre><span></span><span class="k">[servers.ghpages]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[servers.ghpages]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ghpages://your-user/your-repository</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ghpages://your-user/your-repository</span>
</pre></div> </pre></div>
<h2 id="credentials">Credentials</h2><p>This deployment method has two implementations: <code>ghpages</code> (also known as <h2 id="credentials">Credentials</h2><p>This deployment method has two implementations: <code>ghpages</code> (also known as
<code>ghpages+ssh</code>) which uses SSH and <code>ghpages+https</code> which uses HTTPS. They <code>ghpages+ssh</code>) which uses SSH and <code>ghpages+https</code> which uses HTTPS. They
@ -180,8 +180,8 @@ with behavior for GitHub Pages.</p>
<h2 id="cname-support">CNAME Support</h2><p>If you want to use a custom domain with GitHub pages (also known as a <h2 id="cname-support">CNAME Support</h2><p>If you want to use a custom domain with GitHub pages (also known as a
<a href="https://en.wikipedia.org/wiki/CNAME" class="ext">CNAME</a>), provide the intended <a href="https://en.wikipedia.org/wiki/CNAME" class="ext">CNAME</a>), provide the intended
CNAME in the target URL using the <code>?cname</code> parameter:</p> CNAME in the target URL using the <code>?cname</code> parameter:</p>
<div class="hll"><pre><span></span><span class="k">[servers.production]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[servers.production]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ghpages://your-user/your-repository?cname=www.example.com</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ghpages://your-user/your-repository?cname=www.example.com</span>
</pre></div> </pre></div>
<p>Note that this will overwrite whatever custom domain you may have set on <p>Note that this will overwrite whatever custom domain you may have set on
GitHub with every deployment.</p> GitHub with every deployment.</p>

View File

@ -168,17 +168,17 @@ repository for it needs to be named <code>&lt;username&gt;.gitlab.io</code>.</p>
<code>.gitlab-ci.yml</code> which contains a configuration for gitlab pages.</p> <code>.gitlab-ci.yml</code> which contains a configuration for gitlab pages.</p>
<h2 id="configuration">Configuration</h2><p>To enable support for Lektor you need to create a <code>.gitlab-ci.yml</code> config <h2 id="configuration">Configuration</h2><p>To enable support for Lektor you need to create a <code>.gitlab-ci.yml</code> config
next to your <code>.lektorproject</code> file with the following contents:</p> next to your <code>.lektorproject</code> file with the following contents:</p>
<div class="hll"><pre><span></span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python:latest</span><span class="w"></span> <div class="hll"><pre><span></span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python:latest</span>
<span class="nt">pages</span><span class="p">:</span><span class="w"></span> <span class="nt">pages</span><span class="p">:</span>
<span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">script</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pip install lektor</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pip install lektor</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lektor build --output-path public</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lektor build --output-path public</span>
<span class="w"> </span><span class="nt">artifacts</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">artifacts</span><span class="p">:</span>
<span class="w"> </span><span class="nt">paths</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">paths</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">public</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">public</span>
<span class="w"> </span><span class="nt">only</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">only</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">master</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">master</span>
</pre></div> </pre></div>
<p>It's important that the output path is set to <code>public</code> as this is what <p>It's important that the output path is set to <code>public</code> as this is what
will be served up. In case you want to use a different branch than <code>master</code> will be served up. In case you want to use a different branch than <code>master</code>
@ -192,26 +192,26 @@ To do so, you have to:</p>
<li>configure Gitlab to cache this directory.</li> <li>configure Gitlab to cache this directory.</li>
</ul> </ul>
<p>See the example below.</p> <p>See the example below.</p>
<div class="hll"><pre><span></span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python:latest</span><span class="w"></span> <div class="hll"><pre><span></span><span class="nt">image</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python:latest</span>
<span class="nt">default</span><span class="p">:</span><span class="w"></span> <span class="nt">default</span><span class="p">:</span>
<span class="w"> </span><span class="nt">cache</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">cache</span><span class="p">:</span>
<span class="w"> </span><span class="nt">paths</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">paths</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">.cache/lektor</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">.cache/lektor</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">.cache/pip</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">.cache/pip</span>
<span class="nt">variables</span><span class="p">:</span><span class="w"></span> <span class="nt">variables</span><span class="p">:</span>
<span class="w"> </span><span class="nt">XDG_CACHE_HOME</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;$CI_PROJECT_DIR/.cache&quot;</span><span class="w"></span> <span class="w"> </span><span class="nt">XDG_CACHE_HOME</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;$CI_PROJECT_DIR/.cache&quot;</span>
<span class="nt">pages</span><span class="p">:</span><span class="w"></span> <span class="nt">pages</span><span class="p">:</span>
<span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">script</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pip install lektor</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">pip install lektor</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lektor build --output-path public</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">lektor build --output-path public</span>
<span class="w"> </span><span class="nt">artifacts</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">artifacts</span><span class="p">:</span>
<span class="w"> </span><span class="nt">paths</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">paths</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">public</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">public</span>
<span class="w"> </span><span class="nt">only</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">only</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">master</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">master</span>
</pre></div> </pre></div>
<h2 id="cname-support">CNAME Support</h2><p>If you want to use a <a href="https://en.wikipedia.org/wiki/CNAME" class="ext">CNAME</a> with <h2 id="cname-support">CNAME Support</h2><p>If you want to use a <a href="https://en.wikipedia.org/wiki/CNAME" class="ext">CNAME</a> with
GitLab pages you can configure it in the GitLab settings:</p> GitLab pages you can configure it in the GitLab settings:</p>

View File

@ -179,11 +179,11 @@ keys are <code>name</code> for an optional human readable name of the server, <c
enable or disable it (defaults to <code>true</code>) and <code>target</code> which is the URL to enable or disable it (defaults to <code>true</code>) and <code>target</code> which is the URL to
publish to. Additionally one of the servers can have <code>default</code> set to <code>yes</code> publish to. Additionally one of the servers can have <code>default</code> set to <code>yes</code>
to set it as default. Here is an example:</p> to set it as default. Here is an example:</p>
<div class="hll"><pre><span></span><span class="k">[servers.production]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[servers.production]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Production</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Production</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://server/path/to/folder</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://server/path/to/folder</span>
</pre></div> </pre></div>
<p>To trigger a deploy you can use the <a href="../cli/deploy/" class="ref">deploy</a> command:</p> <p>To trigger a deploy you can use the <a href="../cli/deploy/" class="ref">deploy</a> command:</p>
<pre><code>$ lektor deploy production <pre><code>$ lektor deploy production

View File

@ -154,8 +154,8 @@ way. It uses the system's SSH config so for authentication just configure
SSH as you would normally do. The <code>username</code> part is optional and defaults SSH as you would normally do. The <code>username</code> part is optional and defaults
to the current user that is signed into the machine or whatever is picked up to the current user that is signed into the machine or whatever is picked up
as default from the <code>.ssh/config</code>.</p> as default from the <code>.ssh/config</code>.</p>
<h2 id="example">Example</h2><div class="hll"><pre><span></span><span class="k">[servers.production]</span><span class="w"></span> <h2 id="example">Example</h2><div class="hll"><pre><span></span><span class="k">[servers.production]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://deploy@example.com/var/www/example.com</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://deploy@example.com/var/www/example.com</span>
</pre></div> </pre></div>
<h2 id="credentials">Credentials</h2><p>The <code>rsync</code> deploy method supports both username and password parameter <h2 id="credentials">Credentials</h2><p>The <code>rsync</code> deploy method supports both username and password parameter
though it's recommended to use <code>.ssh/config</code> and an SSH agent to secure though it's recommended to use <code>.ssh/config</code> and an SSH agent to secure
@ -175,8 +175,8 @@ assumed.</p>
it's necessary to explicitly tell <code>rsync</code> to remove files or directories it's necessary to explicitly tell <code>rsync</code> to remove files or directories
on target that don't exist on source anymore. This can be done using the on target that don't exist on source anymore. This can be done using the
<code>?delete</code> URL parameter:</p> <code>?delete</code> URL parameter:</p>
<div class="hll"><pre><span></span><span class="k">[servers.production]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[servers.production]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://server/path/to/folder?delete</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://server/path/to/folder?delete</span>
</pre></div> </pre></div>
<p>If the parameter is provided Lektor will issue a <code>rsync --delete-delay</code>, <p>If the parameter is provided Lektor will issue a <code>rsync --delete-delay</code>,
which performs deletions after all other transfers ended, and only in case which performs deletions after all other transfers ended, and only in case
@ -186,8 +186,8 @@ on target that does not exist on source. This means that if you have files
in the target tree that are not managed by lektor, they will get removed.</p></div><h2 id="exclusion-support">Exclusion Support</h2><p>You can exclude items from being synced by using one or more <code>exclude</code> in the target tree that are not managed by lektor, they will get removed.</p></div><h2 id="exclusion-support">Exclusion Support</h2><p>You can exclude items from being synced by using one or more <code>exclude</code>
parameters. This is also useful in combination with <code>delete</code> to prevent parameters. This is also useful in combination with <code>delete</code> to prevent
removal of files in the target tree that are not managed by lektor:</p> removal of files in the target tree that are not managed by lektor:</p>
<div class="hll"><pre><span></span><span class="k">[servers.production]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[servers.production]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://server/path/to/folder?delete&amp;exclude=target_item_1&amp;exclude=target_item_2</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://server/path/to/folder?delete&amp;exclude=target_item_1&amp;exclude=target_item_2</span>
</pre></div> </pre></div>

View File

@ -167,13 +167,13 @@ GitHub account.</p>
<p>This guide is also available as a <a href="https://www.youtube.com/embed/3pj_EyZIL5A">7 minute screencast</a>.</p> <p>This guide is also available as a <a href="https://www.youtube.com/embed/3pj_EyZIL5A">7 minute screencast</a>.</p>
<h2 id="travis-config">Travis Config</h2><p>Once you have signed up for Travis-CI you need to add a <code>.travis.yml</code> config <h2 id="travis-config">Travis Config</h2><p>Once you have signed up for Travis-CI you need to add a <code>.travis.yml</code> config
file into your repository. You can copy paste this over:</p> file into your repository. You can copy paste this over:</p>
<div class="hll"><pre><span></span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python</span><span class="w"></span> <div class="hll"><pre><span></span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python</span>
<span class="nt">python</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3.6</span><span class="w"></span> <span class="nt">python</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3.6</span>
<span class="nt">install</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;pip</span><span class="nv"> </span><span class="s">install</span><span class="nv"> </span><span class="s">Lektor&quot;</span><span class="w"></span> <span class="nt">install</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;pip</span><span class="nv"> </span><span class="s">install</span><span class="nv"> </span><span class="s">Lektor&quot;</span>
<span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">build&quot;</span><span class="w"></span> <span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">build&quot;</span>
<span class="nt">deploy</span><span class="p">:</span><span class="w"></span> <span class="nt">deploy</span><span class="p">:</span>
<span class="w"> </span><span class="nt">provider</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">script</span><span class="w"></span> <span class="w"> </span><span class="nt">provider</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">script</span>
<span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">deploy</span><span class="nv"> </span><span class="s">ghpages&quot;</span><span class="w"></span> <span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">deploy</span><span class="nv"> </span><span class="s">ghpages&quot;</span>
</pre></div> </pre></div>
<p>Because Travis already comes with all dependencies we need other than <p>Because Travis already comes with all dependencies we need other than
Lektor itself we just need to pip install Lektor and we're ready to go. For Lektor itself we just need to pip install Lektor and we're ready to go. For
@ -182,8 +182,8 @@ the build step we invoke <code>lektor build</code>, and for the deploy step we i
to configure that.</p> to configure that.</p>
<h2 id="project-server-config">Project Server Config</h2><p>For the above example the best way to configure the server for the deployment <h2 id="project-server-config">Project Server Config</h2><p>For the above example the best way to configure the server for the deployment
in the project file would be to use <code>ghpages+https</code> like this:</p> in the project file would be to use <code>ghpages+https</code> like this:</p>
<div class="hll"><pre><span></span><span class="k">[servers.ghpages]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[servers.ghpages]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ghpages+https://username/repository</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ghpages+https://username/repository</span>
</pre></div> </pre></div>
<p>You need to add this to your <code>.lektorproject</code> file.</p> <p>You need to add this to your <code>.lektorproject</code> file.</p>
<p>Whenever Travis builds it will automatically throw the end result into the <p>Whenever Travis builds it will automatically throw the end result into the
@ -227,17 +227,17 @@ the Travis CI documentation.</p>
<h2 id="speeding-up-builds-with-caching">Speeding up Builds with Caching</h2><p>In the default setting Travis will have to rebuild everything because between <h2 id="speeding-up-builds-with-caching">Speeding up Builds with Caching</h2><p>In the default setting Travis will have to rebuild everything because between
builds it does not cache the build results. You can change this by enabling builds it does not cache the build results. You can change this by enabling
caching. Adjust your <code>.travis.yml</code> file to look like this:</p> caching. Adjust your <code>.travis.yml</code> file to look like this:</p>
<div class="hll"><pre><span></span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python</span><span class="w"></span> <div class="hll"><pre><span></span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python</span>
<span class="nt">python</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3.6</span><span class="w"></span> <span class="nt">python</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3.6</span>
<span class="nt">cache</span><span class="p">:</span><span class="w"></span> <span class="nt">cache</span><span class="p">:</span>
<span class="w"> </span><span class="nt">directories</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">directories</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">$HOME/.cache/pip</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">$HOME/.cache/pip</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">$HOME/.cache/lektor/builds</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">$HOME/.cache/lektor/builds</span>
<span class="nt">install</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;pip</span><span class="nv"> </span><span class="s">install</span><span class="nv"> </span><span class="s">Lektor&quot;</span><span class="w"></span> <span class="nt">install</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;pip</span><span class="nv"> </span><span class="s">install</span><span class="nv"> </span><span class="s">Lektor&quot;</span>
<span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">build&quot;</span><span class="w"></span> <span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">build&quot;</span>
<span class="nt">deploy</span><span class="p">:</span><span class="w"></span> <span class="nt">deploy</span><span class="p">:</span>
<span class="w"> </span><span class="nt">provider</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">script</span><span class="w"></span> <span class="w"> </span><span class="nt">provider</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">script</span>
<span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">deploy</span><span class="nv"> </span><span class="s">ghpages&quot;</span><span class="w"></span> <span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">deploy</span><span class="nv"> </span><span class="s">ghpages&quot;</span>
</pre></div> </pre></div>
<p>Note that it is also possible to set the cache directory of Lektor using the <p>Note that it is also possible to set the cache directory of Lektor using the
environment variable <code>XDG_CACHE_HOME</code>, and cache this directory instead, environment variable <code>XDG_CACHE_HOME</code>, and cache this directory instead,
@ -245,19 +245,19 @@ as done with <a href="../glpages/">Gitlab pages</a>.</p>
<h2 id="restricting-branches">Restricting Branches</h2><p>If you plan on having different branches and contributors you should disable <h2 id="restricting-branches">Restricting Branches</h2><p>If you plan on having different branches and contributors you should disable
the deployment to the master branch only. You can do this with the following the deployment to the master branch only. You can do this with the following
config:</p> config:</p>
<div class="hll"><pre><span></span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python</span><span class="w"></span> <div class="hll"><pre><span></span><span class="nt">language</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">python</span>
<span class="nt">python</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3.6</span><span class="w"></span> <span class="nt">python</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">3.6</span>
<span class="nt">cache</span><span class="p">:</span><span class="w"></span> <span class="nt">cache</span><span class="p">:</span>
<span class="w"> </span><span class="nt">directories</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">directories</span><span class="p">:</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">$HOME/.cache/pip</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">$HOME/.cache/pip</span>
<span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">$HOME/.cache/lektor/builds</span><span class="w"></span> <span class="w"> </span><span class="p p-Indicator">-</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">$HOME/.cache/lektor/builds</span>
<span class="nt">install</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;pip</span><span class="nv"> </span><span class="s">install</span><span class="nv"> </span><span class="s">Lektor&quot;</span><span class="w"></span> <span class="nt">install</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;pip</span><span class="nv"> </span><span class="s">install</span><span class="nv"> </span><span class="s">Lektor&quot;</span>
<span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">build&quot;</span><span class="w"></span> <span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">build&quot;</span>
<span class="nt">deploy</span><span class="p">:</span><span class="w"></span> <span class="nt">deploy</span><span class="p">:</span>
<span class="w"> </span><span class="nt">provider</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">script</span><span class="w"></span> <span class="w"> </span><span class="nt">provider</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">script</span>
<span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">deploy</span><span class="nv"> </span><span class="s">ghpages&quot;</span><span class="w"></span> <span class="w"> </span><span class="nt">script</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;lektor</span><span class="nv"> </span><span class="s">deploy</span><span class="nv"> </span><span class="s">ghpages&quot;</span>
<span class="w"> </span><span class="nt">on</span><span class="p">:</span><span class="w"></span> <span class="w"> </span><span class="nt">on</span><span class="p">:</span>
<span class="w"> </span><span class="nt">branch</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">master</span><span class="w"></span> <span class="w"> </span><span class="nt">branch</span><span class="p">:</span><span class="w"> </span><span class="l l-Scalar l-Scalar-Plain">master</span>
</pre></div> </pre></div>

View File

@ -188,48 +188,48 @@ page and what the order is. We also set it to <code>hidden</code> and <code>pro
will make it unavailable in the admin (<code>hidden</code>) for new pages and make it will make it unavailable in the admin (<code>hidden</code>) for new pages and make it
impossible to delete (<code>protected</code>). This means we need to manually create the impossible to delete (<code>protected</code>). This means we need to manually create the
one page later which will use this.</p> one page later which will use this.</p>
<div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[children]</span><span class="w"></span> <span class="k">[children]</span>
<span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span><span class="w"></span> <span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">-pub_date, title</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">-pub_date, title</span>
<span class="k">[pagination]</span><span class="w"></span> <span class="k">[pagination]</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">per_page</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">10</span><span class="w"></span> <span class="na">per_page</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">10</span>
</pre></div> </pre></div>
<h3 id="blog-post.ini`"><code>blog-post.ini</code></h3><p>Each blog post has a title, publication date, author and body. The publication <h3 id="blog-post.ini`"><code>blog-post.ini</code></h3><p>Each blog post has a title, publication date, author and body. The publication
date and title are also used for sorting if you look into the <code>blog.ini</code>. date and title are also used for sorting if you look into the <code>blog.ini</code>.
Lastly we set up the label of the page to be the title of the blog post. We Lastly we set up the label of the page to be the title of the blog post. We
can also set it to <code>hidden</code> as the model is automatically selected in the can also set it to <code>hidden</code> as the model is automatically selected in the
admin whenever a page is created in the blog.</p> admin whenever a page is created in the blog.</p>
<div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog Post</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog Post</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[fields.title]</span><span class="w"></span> <span class="k">[fields.title]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="na">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">large</span><span class="w"></span> <span class="na">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">large</span>
<span class="k">[fields.pub_date]</span><span class="w"></span> <span class="k">[fields.pub_date]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Publication date</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Publication date</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">date</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">date</span>
<span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/2</span><span class="w"></span> <span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/2</span>
<span class="k">[fields.author]</span><span class="w"></span> <span class="k">[fields.author]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Author</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Author</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/2</span><span class="w"></span> <span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/2</span>
<span class="k">[fields.body]</span><span class="w"></span> <span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
</pre></div> </pre></div>
<h2 id="the-templates">The Templates</h2><p>Now that we have the models set up, we want to create the templates.</p> <h2 id="the-templates">The Templates</h2><p>Now that we have the models set up, we want to create the templates.</p>
<h3 id="blog.html`"><code>blog.html</code></h3><p>Let's start with the blog overview page. This template is used for our <code>blog</code> <h3 id="blog.html`"><code>blog.html</code></h3><p>Let's start with the blog overview page. This template is used for our <code>blog</code>
@ -284,7 +284,7 @@ with the name of your blog. For instance just <code>content/blog</code> and put
into the URL? That's thankfully very easy. All you need to do is to set up into the URL? That's thankfully very easy. All you need to do is to set up
a new URL format for the children. Just edit <code>blog.ini</code> and add this to a new URL format for the children. Just edit <code>blog.ini</code> and add this to
the <code>[children]</code> section:</p> the <code>[children]</code> section:</p>
<div class="hll"><pre><span></span><span class="na">slug_format</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ (this.pub_date|dateformat(&#39;YYYY/M/&#39;) if this.pub_date) ~ this._id }}</span><span class="w"></span> <div class="hll"><pre><span></span><span class="na">slug_format</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ (this.pub_date|dateformat(&#39;YYYY/M/&#39;) if this.pub_date) ~ this._id }}</span>
</pre></div> </pre></div>
<p>What this does is that it will prepend the year (<code>YYYY</code>) and month (<code>M</code>) to <p>What this does is that it will prepend the year (<code>YYYY</code>) and month (<code>M</code>) to
the ID of the page if the publication date is configured. Otherwise it will the ID of the page if the publication date is configured. Otherwise it will

View File

@ -200,64 +200,64 @@ different categories and it should be possible to see which projects belong
to which category.</p> to which category.</p>
<h2 id="the-models">The Models</h2><p>So we will end up with four models: <code>projects.ini</code>, <code>project.ini</code>, <h2 id="the-models">The Models</h2><p>So we will end up with four models: <code>projects.ini</code>, <code>project.ini</code>,
<code>project-categories.ini</code> and <code>project-category.ini</code>. Here is how they look:</p> <code>project-categories.ini</code> and <code>project-category.ini</code>. Here is how they look:</p>
<h3 id="projects.ini`"><code>projects.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <h3 id="projects.ini`"><code>projects.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Projects</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Projects</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Projects</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Projects</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[children]</span><span class="w"></span> <span class="k">[children]</span>
<span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">project</span><span class="w"></span> <span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">project</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">-date, name</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">-date, name</span>
</pre></div> </pre></div>
<h3 id="project.ini`"><code>project.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <h3 id="project.ini`"><code>project.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.name }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.name }}</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[fields.name]</span><span class="w"></span> <span class="k">[fields.name]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Name</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Name</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="k">[fields.date]</span><span class="w"></span> <span class="k">[fields.date]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Date</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Date</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">date</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">date</span>
<span class="k">[fields.description]</span><span class="w"></span> <span class="k">[fields.description]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Description</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Description</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
<span class="k">[fields.categories]</span><span class="w"></span> <span class="k">[fields.categories]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Categories</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Categories</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">checkboxes</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">checkboxes</span>
<span class="na">source</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/project-categories&#39;)</span><span class="w"></span> <span class="na">source</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/project-categories&#39;)</span>
</pre></div> </pre></div>
<p>The above models should be mostly clear. What is probably not entirely clear <p>The above models should be mostly clear. What is probably not entirely clear
is the <code>source</code> parameter for the categories. Essentially we instruct the is the <code>source</code> parameter for the categories. Essentially we instruct the
admin panel to fill the selection for the checkboxes from the child pages admin panel to fill the selection for the checkboxes from the child pages
below the <code>project-categories</code> folder. This is where we will maintain the below the <code>project-categories</code> folder. This is where we will maintain the
categories.</p> categories.</p>
<h3 id="project-categories.ini`"><code>project-categories.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <h3 id="project-categories.ini`"><code>project-categories.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project Categories</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project Categories</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project Categories</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project Categories</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[children]</span><span class="w"></span> <span class="k">[children]</span>
<span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">project-category</span><span class="w"></span> <span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">project-category</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">name</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">name</span>
</pre></div> </pre></div>
<h3 id="project-category.ini`"><code>project-category.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <h3 id="project-category.ini`"><code>project-category.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project Category</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project Category</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.name }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.name }}</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[children]</span><span class="w"></span> <span class="k">[children]</span>
<span class="na">replaced_with</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/projects&#39;).filter(F.categories.contains(this))</span><span class="w"></span> <span class="na">replaced_with</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/projects&#39;).filter(F.categories.contains(this))</span>
<span class="k">[fields.name]</span><span class="w"></span> <span class="k">[fields.name]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Name</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Name</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
</pre></div> </pre></div>
<p>So this is where the magic lives. the <code>replaced_with</code> key in the <code>[children]</code> <p>So this is where the magic lives. the <code>replaced_with</code> key in the <code>[children]</code>
section tells Lektor to ignore the child pages that would normally exist below section tells Lektor to ignore the child pages that would normally exist below

View File

@ -178,7 +178,7 @@ for you:</p>
website. Just create a file named <code>disqus-comments.ini</code> into your website. Just create a file named <code>disqus-comments.ini</code> into your
<code>configs/</code> folder and configure the <code>shortname</code> key with the name of <code>configs/</code> folder and configure the <code>shortname</code> key with the name of
your disqus community:</p> your disqus community:</p>
<div class="hll"><pre><span></span><span class="na">shortname</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">YOUR_SHORTNAME</span><span class="w"></span> <div class="hll"><pre><span></span><span class="na">shortname</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">YOUR_SHORTNAME</span>
</pre></div> </pre></div>
<h2 id="in-templates">In Templates</h2><p>Now you can add a discussion box to any of your templates by just using <h2 id="in-templates">In Templates</h2><p>Now you can add a discussion box to any of your templates by just using
the <code>render_disqus_comments</code> function. Just calling it is enough to the <code>render_disqus_comments</code> function. Just calling it is enough to

View File

@ -184,8 +184,8 @@ development server. To test those you will need to explicitly navigate to
that relative URLs <em>will not work</em>. If you want to use custom error pages you that relative URLs <em>will not work</em>. If you want to use custom error pages you
will have to set the <code>url_style</code> to <code>absolute</code> as otherwise URLs on an error will have to set the <code>url_style</code> to <code>absolute</code> as otherwise URLs on an error
page will not work. Just add this to your project file:</p> page will not work. Just add this to your project file:</p>
<div class="hll"><pre><span></span><span class="k">[project]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[project]</span>
<span class="na">url_style</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">absolute</span><span class="w"></span> <span class="na">url_style</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">absolute</span>
</pre></div> </pre></div>
<p>For more information about this you can read the <a href="../../project/file/" class="ref">Project File Documentation</a>.</p> <p>For more information about this you can read the <a href="../../project/file/" class="ref">Project File Documentation</a>.</p>
<h2 id="creating-an-error-page">Creating an Error Page</h2><p>You can easily add a 404 page by creating a <code>404.html/contents.lr</code> <h2 id="creating-an-error-page">Creating an Error Page</h2><p>You can easily add a 404 page by creating a <code>404.html/contents.lr</code>
@ -203,16 +203,16 @@ work slightly differently.</p>
<h3 id="apache">Apache</h3><p>Making custom error pages work is easiest with Apache. If <code>.htaccess</code> files <h3 id="apache">Apache</h3><p>Making custom error pages work is easiest with Apache. If <code>.htaccess</code> files
are enabled you can just put a file with that name into your <code>assets</code> folder are enabled you can just put a file with that name into your <code>assets</code> folder
and add the following line to it:</p> and add the following line to it:</p>
<div class="hll"><pre><span></span><span class="nb">ErrorDocument</span><span class="w"> </span><span class="m">404</span><span class="w"> </span><span class="sx">/404.html</span><span class="w"></span> <div class="hll"><pre><span></span><span class="nb">ErrorDocument</span><span class="w"> </span><span class="m">404</span><span class="w"> </span><span class="sx">/404.html</span>
</pre></div> </pre></div>
<p>Alternatively you can add the above line into a <code>VirtualHost</code> or <code>Directory</code> <p>Alternatively you can add the above line into a <code>VirtualHost</code> or <code>Directory</code>
section in your main config file.</p> section in your main config file.</p>
<h3 id="nginx">nginx</h3><p>For nginx you need to enable the error document in your main config file. Just <h3 id="nginx">nginx</h3><p>For nginx you need to enable the error document in your main config file. Just
add it to your <code>server</code> section:</p> add it to your <code>server</code> section:</p>
<div class="hll"><pre><span></span><span class="k">error_page</span><span class="w"> </span><span class="mi">404</span><span class="w"> </span><span class="s">/404.html</span><span class="p">;</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">error_page</span><span class="w"> </span><span class="mi">404</span><span class="w"> </span><span class="s">/404.html</span><span class="p">;</span>
</pre></div> </pre></div>
<h3 id="lighttpd">lighttpd</h3><p>If you are using lighttpd you can configure an error page for 404 this way:</p> <h3 id="lighttpd">lighttpd</h3><p>If you are using lighttpd you can configure an error page for 404 this way:</p>
<div class="hll"><pre><span></span><span class="na">server.error-handler-404</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;/404.html&quot;</span><span class="w"></span> <div class="hll"><pre><span></span><span class="na">server.error-handler-404</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;/404.html&quot;</span>
</pre></div> </pre></div>

View File

@ -169,24 +169,24 @@ children. This way an order can be defined that is used by default for any
query involving the children of a page. So what can you order by? You can query involving the children of a page. So what can you order by? You can
order by any field you want. For instance to order by the name of a page order by any field you want. For instance to order by the name of a page
you can do this:</p> you can do this:</p>
<div class="hll"><pre><span></span><span class="k">[children]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[children]</span>
<span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">project</span><span class="w"></span> <span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">project</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">name</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">name</span>
</pre></div> </pre></div>
<p>This will automatically order the <code>.children</code> query by the name of a project. <p>This will automatically order the <code>.children</code> query by the name of a project.
You can define more than one ordering. For instance you could order blog You can define more than one ordering. For instance you could order blog
posts by dates in decreasing order and secondarily by the blog title:</p> posts by dates in decreasing order and secondarily by the blog title:</p>
<div class="hll"><pre><span></span><span class="k">[children]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[children]</span>
<span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span><span class="w"></span> <span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">-pub_date, title</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">-pub_date, title</span>
</pre></div> </pre></div>
<p>A minus sign as prefix reverses the order.</p> <p>A minus sign as prefix reverses the order.</p>
<h2 id="specific-order">Specific Order</h2><p>But what to do if you want to order something specifically? In that case you <h2 id="specific-order">Specific Order</h2><p>But what to do if you want to order something specifically? In that case you
can use the <a href="../../api/db/types/sort-key/" class="ref">sort_key</a> type and configure can use the <a href="../../api/db/types/sort-key/" class="ref">sort_key</a> type and configure
that:</p> that:</p>
<div class="hll"><pre><span></span><span class="k">[children]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[children]</span>
<span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">doc-page</span><span class="w"></span> <span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">doc-page</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">sort_key</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">sort_key</span>
</pre></div> </pre></div>
<p>Currently you need to explicitly give numbers in this field but future versions <p>Currently you need to explicitly give numbers in this field but future versions
of Lektor will provide support for automatically reordering them in the admin of Lektor will provide support for automatically reordering them in the admin

View File

@ -171,9 +171,9 @@ subset of the child records per page.</p>
<h2 id="configuring-pagination">Configuring Pagination</h2><p>First you need to enable the pagination in the model. Primarily you need <h2 id="configuring-pagination">Configuring Pagination</h2><p>First you need to enable the pagination in the model. Primarily you need
to enable the pagination and set how many items show up on a page. Just to enable the pagination and set how many items show up on a page. Just
add this to the parent model:</p> add this to the parent model:</p>
<div class="hll"><pre><span></span><span class="k">[pagination]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[pagination]</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">per_page</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">10</span><span class="w"></span> <span class="na">per_page</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">10</span>
</pre></div> </pre></div>
<h2 id="selecting-the-children">Selecting the Children</h2><p>Now that you have the pagination configured you need to iterate only over <h2 id="selecting-the-children">Selecting the Children</h2><p>Now that you have the pagination configured you need to iterate only over
the children of an active page in your template rather than the children of the the children of an active page in your template rather than the children of the

View File

@ -182,51 +182,51 @@ for new pages and make it impossible to delete (<code>protected</code>). This m
need to manually create the one page later which will use this.</p> need to manually create the one page later which will use this.</p>
<p>Because we only have a single page for the projects overview we give it a <p>Because we only have a single page for the projects overview we give it a
static label manually (<code>label = Projects</code>).</p> static label manually (<code>label = Projects</code>).</p>
<div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Projects</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Projects</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Projects</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Projects</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[children]</span><span class="w"></span> <span class="k">[children]</span>
<span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">project</span><span class="w"></span> <span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">project</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">-date, name</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">-date, name</span>
</pre></div> </pre></div>
<h3 id="project.ini`"><code>project.ini</code></h3><p>Next up is the model for the project. This is completely up to you, we will go <h3 id="project.ini`"><code>project.ini</code></h3><p>Next up is the model for the project. This is completely up to you, we will go
with some things here that might appear on such a portfolio page. In addition with some things here that might appear on such a portfolio page. In addition
we will do something with the attachments of this page, but more about that we will do something with the attachments of this page, but more about that
later. For now we just order them by their filename (<code>_id</code>):</p> later. For now we just order them by their filename (<code>_id</code>):</p>
<div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.name }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.name }}</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[attachments]</span><span class="w"></span> <span class="k">[attachments]</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">_id</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">_id</span>
<span class="k">[fields.name]</span><span class="w"></span> <span class="k">[fields.name]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Name</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Name</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="na">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">large</span><span class="w"></span> <span class="na">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">large</span>
<span class="k">[fields.date]</span><span class="w"></span> <span class="k">[fields.date]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Date</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Date</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">date</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">date</span>
<span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/4</span><span class="w"></span> <span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/4</span>
<span class="k">[fields.type]</span><span class="w"></span> <span class="k">[fields.type]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project type</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Project type</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/4</span><span class="w"></span> <span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/4</span>
<span class="k">[fields.website]</span><span class="w"></span> <span class="k">[fields.website]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Website</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Website</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">url</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">url</span>
<span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/2</span><span class="w"></span> <span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1/2</span>
<span class="k">[fields.description]</span><span class="w"></span> <span class="k">[fields.description]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Description</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Description</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
</pre></div> </pre></div>
<h2 id="templates">Templates</h2><p>So now that we have models, we should probably go over what we can do with the <h2 id="templates">Templates</h2><p>So now that we have models, we should probably go over what we can do with the
attachments. Because each page in Lektor can have attachments added we can attachments. Because each page in Lektor can have attachments added we can

View File

@ -169,13 +169,13 @@
<p>Setting up a flexible redirect system to make HTML redirects in Lektor is easy. A better setup would likely be on the server level, for instance in nginx, or configured on your CDN. The redirect will be more performant on the server level. Though this is not the best kind of redirect, it is pretty robust and will work in most situations. This example is flexible and can handle multiple redirects for your site.</p> <p>Setting up a flexible redirect system to make HTML redirects in Lektor is easy. A better setup would likely be on the server level, for instance in nginx, or configured on your CDN. The redirect will be more performant on the server level. Though this is not the best kind of redirect, it is pretty robust and will work in most situations. This example is flexible and can handle multiple redirects for your site.</p>
<h2 id="models-and-templates">Models and Templates</h2><p>Set up the models to have a simple field that can hold the value of the target path. This is the path the page will be redirected to.</p> <h2 id="models-and-templates">Models and Templates</h2><p>Set up the models to have a simple field that can hold the value of the target path. This is the path the page will be redirected to.</p>
<h3 id="models/redirect.ini`"><code>models/redirect.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <h3 id="models/redirect.ini`"><code>models/redirect.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Redirect</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Redirect</span>
<span class="k">[fields.target]</span><span class="w"></span> <span class="k">[fields.target]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Redirect Target</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Redirect Target</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Target is of type &#39;string&#39; to allow relative paths. Converted to url in the template.</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Target is of type &#39;string&#39; to allow relative paths. Converted to url in the template.</span>
</pre></div> </pre></div>
<p>The template contains the minimal amount of html needed to initiate a redirect, along with a query for the target path.</p> <p>The template contains the minimal amount of html needed to initiate a redirect, along with a query for the target path.</p>
<h3 id="templates/redirect.html`"><code>templates/redirect.html</code></h3><div class="hll"><pre><span></span><span class="x">&lt;meta http-equiv=&quot;refresh&quot; content=&quot;0; URL=&#39;</span><span class="cp">{{</span> <span class="nv">this.target</span><span class="o">|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&#39;&quot; /&gt;</span> <h3 id="templates/redirect.html`"><code>templates/redirect.html</code></h3><div class="hll"><pre><span></span><span class="x">&lt;meta http-equiv=&quot;refresh&quot; content=&quot;0; URL=&#39;</span><span class="cp">{{</span> <span class="nv">this.target</span><span class="o">|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&#39;&quot; /&gt;</span>

View File

@ -193,35 +193,35 @@ parts of our big page.</li>
<p>We will just sort all the documentation pages by the page ID so it's possible <p>We will just sort all the documentation pages by the page ID so it's possible
to just order the pages by prefixing the page with a number to just order the pages by prefixing the page with a number
(<code>0001-installation</code>, <code>0002-quickstart</code> etc.)</p> (<code>0001-installation</code>, <code>0002-quickstart</code> etc.)</p>
<h3 id="index.ini`"><code>index.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <h3 id="index.ini`"><code>index.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[fields.title]</span><span class="w"></span> <span class="k">[fields.title]</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
</pre></div> </pre></div>
<h3 id="doc-pages.ini`"><code>doc-pages.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <h3 id="doc-pages.ini`"><code>doc-pages.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation Pages</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation Pages</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation Pages</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation Pages</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">protected</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[children]</span><span class="w"></span> <span class="k">[children]</span>
<span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">doc-page</span><span class="w"></span> <span class="na">model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">doc-page</span>
<span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">_id</span><span class="w"></span> <span class="na">order_by</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">_id</span>
</pre></div> </pre></div>
<h3 id="doc-page.ini`"><code>doc-page.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <h3 id="doc-page.ini`"><code>doc-page.ini</code></h3><div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation Page</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Documentation Page</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span>
<span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">hidden</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="k">[fields.title]</span><span class="w"></span> <span class="k">[fields.title]</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="k">[fields.body]</span><span class="w"></span> <span class="k">[fields.body]</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
</pre></div> </pre></div>
<h2 id="initializing-the-contents">Initializing the Contents</h2><p>Now that we have the models we need to set up the initial pages. All our <h2 id="initializing-the-contents">Initializing the Contents</h2><p>Now that we have the models we need to set up the initial pages. All our
models are hidden which means that we cannot use the admin panel to setup models are hidden which means that we cannot use the admin panel to setup

View File

@ -181,11 +181,11 @@ pages which should be excluded from navigation or automatic link generation.</p>
iterate over all pages of the site recursively. This also automatically iterate over all pages of the site recursively. This also automatically
skips hidden pages so those will not be generated out.</p> skips hidden pages so those will not be generated out.</p>
<div class="hll"><pre><span></span><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span> <div class="hll"><pre><span></span><span class="cp">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span>
<span class="nt">&lt;urlset</span> <span class="na">xmlns=</span><span class="s">&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;</span><span class="nt">&gt;</span> <span class="nt">&lt;urlset</span><span class="w"> </span><span class="na">xmlns=</span><span class="s">&quot;http://www.sitemaps.org/schemas/sitemap/0.9&quot;</span><span class="nt">&gt;</span>
<span class="cp">{%</span>- <span class="k">for</span> <span class="nv">page</span> <span class="k">in</span> <span class="o">[</span><span class="nv">site.root</span><span class="o">]</span> <span class="k">if</span> <span class="nv">page</span> <span class="o">!=</span> <span class="nv">this</span> <span class="k">recursive</span> <span class="cp">%}</span> <span class="w"> </span><span class="cp">{%</span>- <span class="k">for</span> <span class="nv">page</span> <span class="k">in</span> <span class="o">[</span><span class="nv">site.root</span><span class="o">]</span> <span class="k">if</span> <span class="nv">page</span> <span class="o">!=</span> <span class="nv">this</span> <span class="k">recursive</span> <span class="cp">%}</span>
<span class="nt">&lt;url&gt;&lt;loc&gt;</span><span class="cp">{{</span> <span class="nv">page</span><span class="o">|</span><span class="nf">url</span><span class="o">(</span><span class="nv">external</span><span class="o">=</span><span class="kp">true</span><span class="o">)</span> <span class="cp">}}</span><span class="nt">&lt;/loc&gt;&lt;/url&gt;</span> <span class="w"> </span><span class="nt">&lt;url&gt;&lt;loc&gt;</span><span class="cp">{{</span> <span class="nv">page</span><span class="o">|</span><span class="nf">url</span><span class="o">(</span><span class="nv">external</span><span class="o">=</span><span class="kp">true</span><span class="o">)</span> <span class="cp">}}</span><span class="nt">&lt;/loc&gt;&lt;/url&gt;</span>
<span class="cp">{{</span><span class="o">-</span> <span class="nb">loop</span><span class="o">(</span><span class="nv">page.children</span><span class="o">|</span><span class="nf">sort</span><span class="o">(</span><span class="nv">attribute</span><span class="o">=</span><span class="s1">&#39;path&#39;</span><span class="o">))</span> <span class="cp">}}</span> <span class="w"> </span><span class="cp">{{</span><span class="o">-</span> <span class="nb">loop</span><span class="o">(</span><span class="nv">page.children</span><span class="o">|</span><span class="nf">sort</span><span class="o">(</span><span class="nv">attribute</span><span class="o">=</span><span class="s1">&#39;path&#39;</span><span class="o">))</span> <span class="cp">}}</span>
<span class="cp">{%</span>- <span class="k">endfor</span> <span class="cp">%}</span> <span class="w"> </span><span class="cp">{%</span>- <span class="k">endfor</span> <span class="cp">%}</span>
<span class="nt">&lt;/urlset&gt;</span> <span class="nt">&lt;/urlset&gt;</span>
</pre></div> </pre></div>
<p>Sorting the page using <code>|sort(attribute='path')</code> is not mandatory, but can be <p>Sorting the page using <code>|sort(attribute='path')</code> is not mandatory, but can be

View File

@ -200,17 +200,17 @@ values) and then generate a <code>package.json</code> file for you.</p>
<p>It should look similar to the following example. Please <strong>do not</strong> just <p>It should look similar to the following example. Please <strong>do not</strong> just
copy-paste this! Instead run the tool, so that your <code>package.json</code> meets copy-paste this! Instead run the tool, so that your <code>package.json</code> meets
the latest format specification.</p> the latest format specification.</p>
<div class="hll"><pre><span></span><span class="p">{</span><span class="w"></span> <div class="hll"><pre><span></span><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;lektor-example&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;lektor-example&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;0.1.0&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;0.1.0&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;description&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;description&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;main&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;index.js&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;main&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;index.js&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;scripts&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;scripts&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;test&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;test&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;echo \&quot;Error: no test specified\&quot; &amp;&amp; exit 1&quot;</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nt">&quot;author&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;author&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;license&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;MIT&quot;</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;license&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;MIT&quot;</span>
<span class="p">}</span><span class="w"></span> <span class="p">}</span>
</pre></div> </pre></div>
<p>Now we can <code>npm install</code> all the things we want:</p> <p>Now we can <code>npm install</code> all the things we want:</p>
<pre><code>$ npm install --save-dev webpack babel-core node-sass babel-loader sass-loader css-loader url-loader style-loader file-loader extract-text-webpack-plugin <pre><code>$ npm install --save-dev webpack babel-core node-sass babel-loader sass-loader css-loader url-loader style-loader file-loader extract-text-webpack-plugin
@ -232,48 +232,48 @@ installed for as long as someone else ran it before.</p>
<li>all built files will go to <code>assets/static/gen</code></li> <li>all built files will go to <code>assets/static/gen</code></li>
<li>there will be a <code>gen/app.js</code> and a <code>gen/styles.css</code> file to include</li> <li>there will be a <code>gen/app.js</code> and a <code>gen/styles.css</code> file to include</li>
</ul> </ul>
<div class="hll"><pre><span></span><span class="kd">var</span><span class="w"> </span><span class="nx">webpack</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;webpack&#39;</span><span class="p">);</span><span class="w"></span> <div class="hll"><pre><span></span><span class="kd">var</span><span class="w"> </span><span class="nx">webpack</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;webpack&#39;</span><span class="p">);</span>
<span class="kd">var</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;path&#39;</span><span class="p">);</span><span class="w"></span> <span class="kd">var</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;path&#39;</span><span class="p">);</span>
<span class="kd">var</span><span class="w"> </span><span class="nx">ExtractTextPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;extract-text-webpack-plugin&#39;</span><span class="p">);</span><span class="w"></span> <span class="kd">var</span><span class="w"> </span><span class="nx">ExtractTextPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s1">&#39;extract-text-webpack-plugin&#39;</span><span class="p">);</span>
<span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="s1">&#39;app&#39;</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;./js/main.js&#39;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="s1">&#39;app&#39;</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;./js/main.js&#39;</span><span class="p">,</span>
<span class="w"> </span><span class="s1">&#39;styles&#39;</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;./scss/main.scss&#39;</span><span class="w"></span> <span class="w"> </span><span class="s1">&#39;styles&#39;</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;./scss/main.scss&#39;</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="s1">&#39;/assets/static/gen&#39;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="s1">&#39;/assets/static/gen&#39;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;[name].js&#39;</span><span class="w"></span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;[name].js&#39;</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">devtool</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;#cheap-module-source-map&#39;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">devtool</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;#cheap-module-source-map&#39;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">resolve</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">resolve</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">modules</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s1">&#39;node_modules&#39;</span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="nx">modules</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s1">&#39;node_modules&#39;</span><span class="p">],</span>
<span class="w"> </span><span class="nx">extensions</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s1">&#39;.js&#39;</span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="nx">extensions</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s1">&#39;.js&#39;</span><span class="p">]</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">rules</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w"></span> <span class="w"> </span><span class="nx">rules</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.js$/</span><span class="p">,</span><span class="w"> </span><span class="nx">exclude</span><span class="o">:</span><span class="w"> </span><span class="sr">/node_modules/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.js$/</span><span class="p">,</span><span class="w"> </span><span class="nx">exclude</span><span class="o">:</span><span class="w"> </span><span class="sr">/node_modules/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">loader</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;babel-loader&#39;</span><span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="nx">loader</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;babel-loader&#39;</span><span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">loader</span><span class="o">:</span><span class="w"> </span><span class="nx">ExtractTextPlugin</span><span class="p">.</span><span class="nx">extract</span><span class="p">({</span><span class="w"></span> <span class="w"> </span><span class="nx">loader</span><span class="o">:</span><span class="w"> </span><span class="nx">ExtractTextPlugin</span><span class="p">.</span><span class="nx">extract</span><span class="p">({</span>
<span class="w"> </span><span class="nx">fallback</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;style-loader&#39;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">fallback</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;style-loader&#39;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;css-loader!sass-loader&#39;</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;css-loader!sass-loader&#39;</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.css$/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.css$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">loader</span><span class="o">:</span><span class="w"> </span><span class="nx">ExtractTextPlugin</span><span class="p">.</span><span class="nx">extract</span><span class="p">({</span><span class="w"></span> <span class="w"> </span><span class="nx">loader</span><span class="o">:</span><span class="w"> </span><span class="nx">ExtractTextPlugin</span><span class="p">.</span><span class="nx">extract</span><span class="p">({</span>
<span class="w"> </span><span class="nx">fallback</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;style-loader&#39;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">fallback</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;style-loader&#39;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;css-loader&#39;</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;css-loader&#39;</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="p">)</span><span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">loader</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;file&#39;</span><span class="w"> </span><span class="p">}</span><span class="w"></span> <span class="w"> </span><span class="nx">loader</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;file&#39;</span><span class="w"> </span><span class="p">}</span>
<span class="w"> </span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="p">]</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w"></span> <span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">ExtractTextPlugin</span><span class="p">({</span><span class="w"></span> <span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">ExtractTextPlugin</span><span class="p">({</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;styles.css&#39;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s1">&#39;styles.css&#39;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">allChunks</span><span class="o">:</span><span class="w"> </span><span class="kc">true</span><span class="w"></span> <span class="w"> </span><span class="nx">allChunks</span><span class="o">:</span><span class="w"> </span><span class="kc">true</span>
<span class="w"> </span><span class="p">}),</span><span class="w"></span> <span class="w"> </span><span class="p">}),</span>
<span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">webpack</span><span class="p">.</span><span class="nx">optimize</span><span class="p">.</span><span class="nx">UglifyJsPlugin</span><span class="p">()</span><span class="w"></span> <span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">webpack</span><span class="p">.</span><span class="nx">optimize</span><span class="p">.</span><span class="nx">UglifyJsPlugin</span><span class="p">()</span>
<span class="w"> </span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="p">]</span>
<span class="p">};</span><span class="w"></span> <span class="p">};</span>
</pre></div> </pre></div>
<h2 id="creating-the-app">Creating the App</h2><p>Now we can start building our app. We configured at least two files <h2 id="creating-the-app">Creating the App</h2><p>Now we can start building our app. We configured at least two files
in webpack: <code>js/main.js</code> and <code>scss/main.scss</code>. Those are the entry in webpack: <code>js/main.js</code> and <code>scss/main.scss</code>. Those are the entry

View File

@ -195,7 +195,7 @@ important about this is that the slug expression must not fail even if fields
are empty! This is necessary because new pages will start out with the are empty! This is necessary because new pages will start out with the
fields not being filled in.</p> fields not being filled in.</p>
<p>This for instance includes a date in the URL if set:</p> <p>This for instance includes a date in the URL if set:</p>
<div class="hll"><pre><span></span><span class="na">slug_format</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ (this.date|dateformat(&#39;YYYY/M/&#39;) if this.date) ~ this._id }}</span><span class="w"></span> <div class="hll"><pre><span></span><span class="na">slug_format</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ (this.date|dateformat(&#39;YYYY/M/&#39;) if this.date) ~ this._id }}</span>
</pre></div> </pre></div>
<h2 id="pagination">Pagination</h2><p>In general a source document renders into a single page. The exception to <h2 id="pagination">Pagination</h2><p>In general a source document renders into a single page. The exception to
that rule are pages with children which show the children on the rendered that rule are pages with children which show the children on the rendered

View File

@ -147,20 +147,20 @@ Documentation</a> to Flow first.</p>
are stored in the <code>flowblocks/</code> folder and are ini files just like models.</p> are stored in the <code>flowblocks/</code> folder and are ini files just like models.</p>
<p>Instead of using <code>[model]</code> as section, the section is called <code>[block]</code>.</p> <p>Instead of using <code>[model]</code> as section, the section is called <code>[block]</code>.</p>
<p>Here a very basic flow block model <code>flowblocks/text.ini</code>:</p> <p>Here a very basic flow block model <code>flowblocks/text.ini</code>:</p>
<div class="hll"><pre><span></span><span class="k">[block]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[block]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Text Block</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Text Block</span>
<span class="na">button_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Text</span><span class="w"></span> <span class="na">button_label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Text</span>
<span class="k">[fields.text]</span><span class="w"></span> <span class="k">[fields.text]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Text</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Text</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
<span class="k">[fields.class]</span><span class="w"></span> <span class="k">[fields.class]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Class</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Class</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">select</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">select</span>
<span class="na">choices</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">default, centered</span><span class="w"></span> <span class="na">choices</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">default, centered</span>
<span class="na">choice_labels</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Default, Centered</span><span class="w"></span> <span class="na">choice_labels</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Default, Centered</span>
<span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">default</span><span class="w"></span> <span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">default</span>
</pre></div> </pre></div>
<p>This should be self explanatory. One thing that is different about blocks <p>This should be self explanatory. One thing that is different about blocks
compared to regular models is that they support the <code>button_label</code> attribute compared to regular models is that they support the <code>button_label</code> attribute

View File

@ -150,18 +150,18 @@ model has been explicitly selected, a default model will be selected. For
most situations this will be the model with the name <code>page</code>. Detailed most situations this will be the model with the name <code>page</code>. Detailed
information can be found under <a href="selection/" class="ref">Default Model Selection</a>.</p> information can be found under <a href="selection/" class="ref">Default Model Selection</a>.</p>
<p>Here is an example of a very basic model (<code>models/page.ini</code>):</p> <p>Here is an example of a very basic model (<code>models/page.ini</code>):</p>
<div class="hll"><pre><span></span><span class="k">[model]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Page</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Page</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span>
<span class="k">[fields.title]</span><span class="w"></span> <span class="k">[fields.title]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="na">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">large</span><span class="w"></span> <span class="na">size</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">large</span>
<span class="k">[fields.body]</span><span class="w"></span> <span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
</pre></div> </pre></div>
<p>In this particular case, we have a model with the id <code>page</code> (as defined by the <p>In this particular case, we have a model with the id <code>page</code> (as defined by the
filename) and a name <code>Page</code> which will appear like that in the UI. Pages that filename) and a name <code>Page</code> which will appear like that in the UI. Pages that

View File

@ -183,8 +183,8 @@ returns a dict like object to access the ini file.</p>
<span class="n">value</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;section.key&#39;</span><span class="p">,</span> <span class="s1">&#39;default_value&#39;</span><span class="p">)</span> <span class="n">value</span> <span class="o">=</span> <span class="n">config</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s1">&#39;section.key&#39;</span><span class="p">,</span> <span class="s1">&#39;default_value&#39;</span><span class="p">)</span>
</pre></div> </pre></div>
<p>This would correspond to this config in <code>configs/my-plugin.ini</code>:</p> <p>This would correspond to this config in <code>configs/my-plugin.ini</code>:</p>
<div class="hll"><pre><span></span><span class="k">[section]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[section]</span>
<span class="na">key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">the value</span><span class="w"></span> <span class="na">key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">the value</span>
</pre></div> </pre></div>
<h2 id="dependency-tracking">Dependency Tracking</h2><p>While a lot of dependencies are tracked automatically, when you develop a <h2 id="dependency-tracking">Dependency Tracking</h2><p>While a lot of dependencies are tracked automatically, when you develop a
plugin you probably will discover that sometimes you need to track your own plugin you probably will discover that sometimes you need to track your own
@ -228,9 +228,9 @@ function we also track the plugin's filename to rebuild if the plugin changes.</
<h2 id="adding-new-field-types">Adding New Field Types</h2><p>Let's say you want to add an "asciidoc" <h2 id="adding-new-field-types">Adding New Field Types</h2><p>Let's say you want to add an "asciidoc"
<a href="../../api/db/types/" class="ref">field type</a> so you can write with <a href="http://www.methods.co.nz/asciidoc">AsciiDoc</a> markup.</p> <a href="../../api/db/types/" class="ref">field type</a> so you can write with <a href="http://www.methods.co.nz/asciidoc">AsciiDoc</a> markup.</p>
<p>First <a href="http://www.methods.co.nz/asciidoc/INSTALL.html">install AsciiDoc</a> so its command-line program is available. Then update <code>blog-post.ini</code> from the <a href="../../guides/blog/" class="ref">blog guide</a> like so:</p> <p>First <a href="http://www.methods.co.nz/asciidoc/INSTALL.html">install AsciiDoc</a> so its command-line program is available. Then update <code>blog-post.ini</code> from the <a href="../../guides/blog/" class="ref">blog guide</a> like so:</p>
<div class="hll"><pre><span></span><span class="k">[fields.body]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">asciidoc # Custom type.</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">asciidoc</span><span class="w"> </span><span class="c1"># Custom type.</span>
</pre></div> </pre></div>
<p>In a blog post's <code>contents.lr</code>, write some AsciiDoc like:</p> <p>In a blog post's <code>contents.lr</code>, write some AsciiDoc like:</p>
<pre><code>body: <pre><code>body:

View File

@ -142,9 +142,9 @@ to use plugins and how to build your own.</p>
For completely automated plugin management just open your project file in a For completely automated plugin management just open your project file in a
text editor and edit or extend the <code>[packages]</code> section. Just add a line text editor and edit or extend the <code>[packages]</code> section. Just add a line
for each plugin in the form <code>name = version</code>:</p> for each plugin in the form <code>name = version</code>:</p>
<div class="hll"><pre><span></span><span class="k">[packages]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[packages]</span>
<span class="na">lektor-cool-plugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1.0</span><span class="w"></span> <span class="na">lektor-cool-plugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1.0</span>
<span class="na">lektor-other-plugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1.2</span><span class="w"></span> <span class="na">lektor-other-plugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1.2</span>
</pre></div> </pre></div>
<p>It's also possible to use the <a href="../cli/plugins/add/" class="ref">plugins add</a> command <p>It's also possible to use the <a href="../cli/plugins/add/" class="ref">plugins add</a> command
<code>lektor plugin add NAME</code> to automatically add the latest version of a plugin <code>lektor plugin add NAME</code> to automatically add the latest version of a plugin

View File

@ -146,8 +146,8 @@
identify the project for the user interface. The project file is an INI file identify the project for the user interface. The project file is an INI file
(UTF-8 encoded like everything else in Lektor) and the minimal content is the (UTF-8 encoded like everything else in Lektor) and the minimal content is the
name of the project:</p> name of the project:</p>
<div class="hll"><pre><span></span><span class="k">[project]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[project]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Fancy Project</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Fancy Project</span>
</pre></div> </pre></div>
<p>The name of the file can be arbitrary but must have the <code>.lektorproject</code> <p>The name of the file can be arbitrary but must have the <code>.lektorproject</code>
extension or Lektor will not be able to find it. When Lektor looks for a extension or Lektor will not be able to find it. When Lektor looks for a
@ -247,19 +247,19 @@ or match your custom <code>excluded_assets</code> pattern. The wildcard syntax f
<a href="https://docs.python.org/2/library/fnmatch.html">fnmatch</a>.</p> <a href="https://docs.python.org/2/library/fnmatch.html">fnmatch</a>.</p>
</blockquote> </blockquote>
<p>Example:</p> <p>Example:</p>
<div class="hll"><pre><span></span><span class="k">[project]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[project]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Website</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Website</span>
<span class="na">url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://www.mywebsite.invalid/</span><span class="w"></span> <span class="na">url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://www.mywebsite.invalid/</span>
<span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">de_DE</span><span class="w"></span> <span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">de_DE</span>
<span class="na">excluded_assets</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">*.backup, *~</span><span class="w"></span> <span class="na">excluded_assets</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">*.backup, *~</span>
<span class="na">included_assets</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">_special_file</span><span class="w"></span> <span class="na">included_assets</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">_special_file</span>
</pre></div> </pre></div>
<h3 id="packages"><code>[packages]</code></h3><p>This section controls the packages (plugins) that should be installed for <h3 id="packages"><code>[packages]</code></h3><p>This section controls the packages (plugins) that should be installed for
this project. It's a simple key/value list where the key is the plugin this project. It's a simple key/value list where the key is the plugin
name and the value is the version number.</p> name and the value is the version number.</p>
<p>Example:</p> <p>Example:</p>
<div class="hll"><pre><span></span><span class="k">[packages]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[packages]</span>
<span class="na">lektor-webpack-support</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0.1</span><span class="w"></span> <span class="na">lektor-webpack-support</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0.1</span>
</pre></div> </pre></div>
<h3 id="servers.*]`"><code>[servers.*]</code></h3><p>This section can be repeated and each instance sets up a server. The <code>*</code> <h3 id="servers.*]`"><code>[servers.*]</code></h3><p>This section can be repeated and each instance sets up a server. The <code>*</code>
needs to be replaced with the ID of the server. This ID is used by the needs to be replaced with the ID of the server. This ID is used by the
@ -281,11 +281,11 @@ to the deployment guides.</p>
is configured it's an implicit default.</p> is configured it's an implicit default.</p>
</blockquote> </blockquote>
<p>Example:</p> <p>Example:</p>
<div class="hll"><pre><span></span><span class="k">[servers.production]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[servers.production]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Production</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Production</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://server/path/to/folder</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">rsync://server/path/to/folder</span>
</pre></div> </pre></div>
<h3 id="alternatives.*]`"><code>[alternatives.*]</code></h3><p>This configures <a href="../../content/alts/" class="ref">Alternatives</a>. It is repeated for <h3 id="alternatives.*]`"><code>[alternatives.*]</code></h3><p>This configures <a href="../../content/alts/" class="ref">Alternatives</a>. It is repeated for
each intended alternative. The default behavior is that alternatives are each intended alternative. The default behavior is that alternatives are
@ -309,22 +309,22 @@ more information about this refer to the guide.</p>
<blockquote><p>This setting can override the global site locale for a specific alternative.</p> <blockquote><p>This setting can override the global site locale for a specific alternative.</p>
</blockquote> </blockquote>
<p>Example:</p> <p>Example:</p>
<div class="hll"><pre><span></span><span class="k">[alternatives.en]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[alternatives.en]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">English</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">English</span>
<span class="na">primary</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">primary</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">en_US</span><span class="w"></span> <span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">en_US</span>
<span class="k">[alternatives.fr]</span><span class="w"></span> <span class="k">[alternatives.fr]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">French</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">French</span>
<span class="na">url_prefix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/fr/</span><span class="w"></span> <span class="na">url_prefix</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/fr/</span>
<span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">fr</span><span class="w"></span> <span class="na">locale</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">fr</span>
</pre></div> </pre></div>
<h3 id="attachment-types"><code>[attachment_types]</code></h3><p>Lektor does some basic attachment type detection based on file extension. This is what powers the <code>this.attachemnts.images</code> and <code>this.attachments.videos</code> attributes for instance. If the built-in map does not cover your file extension you can extend it or add new attachement types on a project by project basis.</p> <h3 id="attachment-types"><code>[attachment_types]</code></h3><p>Lektor does some basic attachment type detection based on file extension. This is what powers the <code>this.attachemnts.images</code> and <code>this.attachments.videos</code> attributes for instance. If the built-in map does not cover your file extension you can extend it or add new attachement types on a project by project basis.</p>
<p>Example:</p> <p>Example:</p>
<div class="hll"><pre><span></span><span class="k">[attachment_types]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[attachment_types]</span>
<span class="c1">; &lt;.file-ext&gt; = &lt;type&gt;</span><span class="w"></span> <span class="c1">; &lt;.file-ext&gt; = &lt;type&gt;</span>
<span class="na">.gpx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">gpx</span><span class="w"></span> <span class="na">.gpx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">gpx</span>
<span class="na">.ogv</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">video</span><span class="w"></span> <span class="na">.ogv</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">video</span>
</pre></div> </pre></div>

View File

@ -145,7 +145,7 @@
</ul> </ul>
<div class="admonition admonition-warning"><p>Not implemented yet.</p></div><p>You could create a basic empty theme with the following command:</p> <div class="admonition admonition-warning"><p>Not implemented yet.</p></div><p>You could create a basic empty theme with the following command:</p>
<div class="hll"><pre><span></span>$ lektor dev new-theme <div class="hll"><pre><span></span>$<span class="w"> </span>lektor<span class="w"> </span>dev<span class="w"> </span>new-theme
</pre></div> </pre></div>
<h2 id="theme-components">Theme Components:</h2><p>A theme could provide templates, assets, and models (also flowblocks):</p> <h2 id="theme-components">Theme Components:</h2><p>A theme could provide templates, assets, and models (also flowblocks):</p>
<pre><code>demo-theme <pre><code>demo-theme
@ -156,13 +156,13 @@
</code></pre> </code></pre>
<h2 id="the-theme-settings-variable">The theme_settings Variable</h2><p>A <code>theme_settings</code> section in <code>.lektorproject</code> file could be used to <h2 id="the-theme-settings-variable">The theme_settings Variable</h2><p>A <code>theme_settings</code> section in <code>.lektorproject</code> file could be used to
parametrize themes:</p> parametrize themes:</p>
<div class="hll"><pre><span></span><span class="k">[theme_settings]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[theme_settings]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;Lektor&quot;</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;Lektor&quot;</span>
<span class="na">github_url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;https://github.com/lektor&quot;</span><span class="w"></span> <span class="na">github_url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;https://github.com/lektor&quot;</span>
</pre></div> </pre></div>
<p>And those settings will be accessed in templates through the config env <p>And those settings will be accessed in templates through the config env
variable:</p> variable:</p>
<div class="hll"><pre><span></span><span class="cp">{{</span> <span class="nv">config.theme_settings</span><span class="err">.</span><span class="o">&lt;</span><span class="nv">variable_name</span><span class="o">&gt;</span> <span class="cp">}}</span><span class="x"></span> <div class="hll"><pre><span></span><span class="cp">{{</span> <span class="nv">config.theme_settings</span><span class="err">.</span><span class="o">&lt;</span><span class="nv">variable_name</span><span class="o">&gt;</span> <span class="cp">}}</span>
</pre></div> </pre></div>
<p>Example:</p> <p>Example:</p>
<div class="hll"><pre><span></span><span class="x">&lt;a href=&quot;</span><span class="cp">{{</span> <span class="nv">config.theme_settings.github_url</span> <span class="cp">}}</span><span class="x">&quot;&gt;Github&lt;/a&gt;</span> <div class="hll"><pre><span></span><span class="x">&lt;a href=&quot;</span><span class="cp">{{</span> <span class="nv">config.theme_settings.github_url</span> <span class="cp">}}</span><span class="x">&quot;&gt;Github&lt;/a&gt;</span>
@ -173,27 +173,27 @@ variable:</p>
<h2 id="the-theme-ini-file">The theme.ini File</h2><p>Themes could provide a <code>theme.ini</code> file, that is optional, but it's required if <h2 id="the-theme-ini-file">The theme.ini File</h2><p>Themes could provide a <code>theme.ini</code> file, that is optional, but it's required if
you want to add your theme to the lektor community themes.</p> you want to add your theme to the lektor community themes.</p>
<p>Example:</p> <p>Example:</p>
<div class="hll"><pre><span></span><span class="k">[theme]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[theme]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Demo theme</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Demo theme</span>
<span class="na">license</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">MIT</span><span class="w"></span> <span class="na">license</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">MIT</span>
<span class="na">licenselink</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://github.com/lektor/lektor-demo-theme/blob/master/LICENSE.md</span><span class="w"></span> <span class="na">licenselink</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://github.com/lektor/lektor-demo-theme/blob/master/LICENSE.md</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Simple, minimal theme for Lektor</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Simple, minimal theme for Lektor</span>
<span class="na">homepage</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://github.com/lektor/lektor-demo-theme</span><span class="w"></span> <span class="na">homepage</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://github.com/lektor/lektor-demo-theme</span>
<span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">simple, minimal, demo</span><span class="w"></span> <span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">simple, minimal, demo</span>
<span class="na">features</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog</span><span class="w"></span> <span class="na">features</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog</span>
<span class="na">lektor_minimum_required_version</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">3.1</span><span class="w"></span> <span class="na">lektor_minimum_required_version</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">3.1</span>
<span class="k">[author]</span><span class="w"></span> <span class="k">[author]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">lektor</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">lektor</span>
<span class="na">homepage</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">http://getlektor.com/</span><span class="w"></span> <span class="na">homepage</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">http://getlektor.com/</span>
<span class="k">[original]</span><span class="w"></span> <span class="k">[original]</span>
<span class="na">author</span><span class="w"> </span><span class="o">=</span><span class="w"></span> <span class="na">author</span><span class="w"> </span><span class="o">=</span>
<span class="na">homepage</span><span class="w"> </span><span class="o">=</span><span class="w"></span> <span class="na">homepage</span><span class="w"> </span><span class="o">=</span>
<span class="na">repo</span><span class="w"> </span><span class="o">=</span><span class="w"></span> <span class="na">repo</span><span class="w"> </span><span class="o">=</span>
<span class="k">[packages]</span><span class="w"></span> <span class="k">[packages]</span>
<span class="na">lektor-disqus-comments</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0.2</span><span class="w"></span> <span class="na">lektor-disqus-comments</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0.2</span>
</pre></div> </pre></div>
<p>The <code>[original]</code> section is only required if you are porting an existing theme.</p> <p>The <code>[original]</code> section is only required if you are porting an existing theme.</p>
<div class="admonition admonition-warning"><p>Not implemented yet</p></div><p>The <code>lektor_minimum_required_version</code> is used by Lektor to check the <div class="admonition admonition-warning"><p>Not implemented yet</p></div><p>The <code>lektor_minimum_required_version</code> is used by Lektor to check the

View File

@ -149,12 +149,12 @@
</code></pre> </code></pre>
<p>Themes are normally distributed by public Git repositories, so you could install a theme by <p>Themes are normally distributed by public Git repositories, so you could install a theme by
cloning the repo:</p> cloning the repo:</p>
<div class="hll"><pre><span></span><span class="nb">cd</span> themes <div class="hll"><pre><span></span><span class="nb">cd</span><span class="w"> </span>themes
git clone URL_TO_THEME_REPO git<span class="w"> </span>clone<span class="w"> </span>URL_TO_THEME_REPO
</pre></div> </pre></div>
<p>For example, for installing <code>lektor-theme-nix</code>:</p> <p>For example, for installing <code>lektor-theme-nix</code>:</p>
<div class="hll"><pre><span></span><span class="nb">cd</span> themes <div class="hll"><pre><span></span><span class="nb">cd</span><span class="w"> </span>themes
git clone https://github.com/rlaverde/lektor-theme-nix.git git<span class="w"> </span>clone<span class="w"> </span>https://github.com/rlaverde/lektor-theme-nix.git
</pre></div> </pre></div>
<p>If you download several themes, setting <code>themes</code> variable will allow you to only load <p>If you download several themes, setting <code>themes</code> variable will allow you to only load
a particular theme.</p> a particular theme.</p>
@ -163,8 +163,8 @@ search in the
<!-- FIXME: use this link when theme showcase exists [community themes](/themes/) --> <!-- FIXME: use this link when theme showcase exists [community themes](/themes/) -->
<a href="https://github.com/lektor/lektor-themes" class="ext">community themes</a> <a href="https://github.com/lektor/lektor-themes" class="ext">community themes</a>
and automatically install it.</p> and automatically install it.</p>
<div class="hll"><pre><span></span><span class="k">[project]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[project]</span>
<span class="na">themes</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">lektor-theme-nix</span><span class="w"></span> <span class="na">themes</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">lektor-theme-nix</span>
</pre></div> </pre></div>
<h2 id="installing-multiple-themes">Installing Multiple Themes</h2><p>Lektor also supports installing several themes. Copy them to the <code>themes/</code> <h2 id="installing-multiple-themes">Installing Multiple Themes</h2><p>Lektor also supports installing several themes. Copy them to the <code>themes/</code>
folder, and set the <code>themes</code> variable to indicate the precedence (optional).</p> folder, and set the <code>themes</code> variable to indicate the precedence (optional).</p>
@ -177,8 +177,8 @@ folder, and set the <code>themes</code> variable to indicate the precedence (opt
├── lektor-theme-other-theme/ ├── lektor-theme-other-theme/
└── lektor-theme-nix/ └── lektor-theme-nix/
</code></pre> </code></pre>
<div class="hll"><pre><span></span><span class="k">[project]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[project]</span>
<span class="na">themes</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">lektor-theme-nix, lektor-theme-other-theme</span><span class="w"></span> <span class="na">themes</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">lektor-theme-nix, lektor-theme-other-theme</span>
</pre></div> </pre></div>
<p>This will make <code>lektor-theme-nix</code>, because it's listed first, have a higher precedence. <p>This will make <code>lektor-theme-nix</code>, because it's listed first, have a higher precedence.
Files present in multiple themes will be loaded from right to left, so that the first (left-most) Files present in multiple themes will be loaded from right to left, so that the first (left-most)

View File

@ -134,8 +134,8 @@ the theme.</p>
<ol> <ol>
<li><p>You could use the <code>[packages]</code> section of the <code>theme.ini</code> to install <li><p>You could use the <code>[packages]</code> section of the <code>theme.ini</code> to install
released packages:</p> released packages:</p>
<div class="hll"><pre><span></span><span class="k">[packages]</span><span class="w"></span> <div class="hll"><pre><span></span><span class="k">[packages]</span>
<span class="na">lektor-disqus-comments</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0.2</span><span class="w"></span> <span class="na">lektor-disqus-comments</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0.2</span>
</pre></div> </pre></div>
</li> </li>
<li><p>Plugins can be added to the <code>packages/</code> folder in the theme. Each plugin has <li><p>Plugins can be added to the <code>packages/</code> folder in the theme. Each plugin has

View File

@ -151,7 +151,7 @@ speak multiple languages and allow you to easily create localized websites.</li>
<div class="slideshow-wrapper"> <div class="slideshow-wrapper">
<div class="slideshow"> <div class="slideshow">
<div class="slideshow-inner"> <div class="slideshow-inner">
<div class="carousel slide" data-ride="carousel" data-interval="8500" id="carousel-8f723f81b6814daf8580cedff0a9454f"> <div class="carousel slide" data-ride="carousel" data-interval="8500" id="carousel-8ca12761d772490da02699faa5327fcc">
<div class="carousel-inner" role="listbox"> <div class="carousel-inner" role="listbox">
@ -210,11 +210,11 @@ be completely customized.</p>
</div> </div>
</div> </div>
<a class="left carousel-control" href="#carousel-8f723f81b6814daf8580cedff0a9454f" role="button" data-slide="prev"> <a class="left carousel-control" href="#carousel-8ca12761d772490da02699faa5327fcc" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span> <span class="sr-only">Previous</span>
</a> </a>
<a class="right carousel-control" href="#carousel-8f723f81b6814daf8580cedff0a9454f" role="button" data-slide="next"> <a class="right carousel-control" href="#carousel-8ca12761d772490da02699faa5327fcc" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span> <span class="sr-only">Next</span>
</a> </a>

View File

@ -138,30 +138,30 @@
<p>Inspired by the <a href="https://github.com/lektor/lektor-website/tree/master/packages/atom-feed-support" rel="nofollow">atom-feed-support</a> plugin Armin Ronacher wrote for the Lektor official blog.</p> <p>Inspired by the <a href="https://github.com/lektor/lektor-website/tree/master/packages/atom-feed-support" rel="nofollow">atom-feed-support</a> plugin Armin Ronacher wrote for the Lektor official blog.</p>
<h2>Installation</h2> <h2>Installation</h2>
<p>Add lektor-atom to your project from command line:</p> <p>Add lektor-atom to your project from command line:</p>
<pre lang="sh">lektor plugins add lektor-atom <pre lang="sh">lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-atom
</pre> </pre>
<p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p> <p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p>
<h2>Configuration</h2> <h2>Configuration</h2>
<p>Here is a basic configuration:</p> <p>Here is a basic configuration:</p>
<pre lang="ini"><span class="k">[feed]</span><span class="w"></span> <pre lang="ini"><span class="k">[feed]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Site&#39;s Blog</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Site&#39;s Blog</span>
<span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/blog</span><span class="w"></span> <span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/blog</span>
<span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/feed.xml</span><span class="w"></span> <span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/feed.xml</span>
</pre> </pre>
<p>For each feed you want to publish, add a section to <code>configs/atom.ini</code>. For example, a blog with a feed of all recent posts, and a feed of recent posts about coffee:</p> <p>For each feed you want to publish, add a section to <code>configs/atom.ini</code>. For example, a blog with a feed of all recent posts, and a feed of recent posts about coffee:</p>
<pre lang="ini"><span class="k">[blog]</span><span class="w"></span> <pre lang="ini"><span class="k">[blog]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Blog</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Blog</span>
<span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span><span class="w"></span> <span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span>
<span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/feed.xml</span><span class="w"></span> <span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/feed.xml</span>
<span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/&#39;).filter(F.type == &#39;post&#39;)</span><span class="w"></span> <span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/&#39;).filter(F.type == &#39;post&#39;)</span>
<span class="na">item_model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span><span class="w"></span> <span class="na">item_model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span>
<span class="k">[coffee]</span><span class="w"></span> <span class="k">[coffee]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Blog: Articles About Coffee</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">My Blog: Articles About Coffee</span>
<span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span><span class="w"></span> <span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span>
<span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/category/coffee/feed.xml</span><span class="w"></span> <span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/category/coffee/feed.xml</span>
<span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/blog&#39;).filter(F.categories.contains(&#39;coffee&#39;))</span><span class="w"></span> <span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">site.query(&#39;/blog&#39;).filter(F.categories.contains(&#39;coffee&#39;))</span>
<span class="na">item_model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span><span class="w"></span> <span class="na">item_model</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">blog-post</span>
</pre> </pre>
<p>The section names, like <code>blog</code> and <code>coffee</code>, are just used as internal identifiers.</p> <p>The section names, like <code>blog</code> and <code>coffee</code>, are just used as internal identifiers.</p>
<h3>Options</h3> <h3>Options</h3>
@ -243,19 +243,19 @@
</table> </table>
<h3>Customizing the plugin for your models</h3> <h3>Customizing the plugin for your models</h3>
<p>Use the field options to tell lektor-atom how to read your items. For example, if your site's model is:</p> <p>Use the field options to tell lektor-atom how to read your items. For example, if your site's model is:</p>
<pre lang="ini"><span class="k">[model]</span><span class="w"></span> <pre lang="ini"><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog</span>
<span class="k">[fields.writer]</span><span class="w"></span> <span class="k">[fields.writer]</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="k">[fields.short_description]</span><span class="w"></span> <span class="k">[fields.short_description]</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
</pre> </pre>
<p>Then add to atom.ini:</p> <p>Then add to atom.ini:</p>
<pre lang="ini"><span class="k">[main]</span><span class="w"></span> <pre lang="ini"><span class="k">[main]</span>
<span class="na">blog_author_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">writer</span><span class="w"></span> <span class="na">blog_author_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">writer</span>
<span class="na">blog_summary_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">short_description</span><span class="w"></span> <span class="na">blog_summary_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">short_description</span>
</pre> </pre>
<p>See <a href="https://github.com/ajdavis/lektor-atom/blob/master/tests/demo-project/configs/atom.ini" rel="nofollow">tests/demo-project/configs/atom.ini</a> for a complete example.</p> <p>See <a href="https://github.com/ajdavis/lektor-atom/blob/master/tests/demo-project/configs/atom.ini" rel="nofollow">tests/demo-project/configs/atom.ini</a> for a complete example.</p>
<h3>Filtering items</h3> <h3>Filtering items</h3>
@ -263,8 +263,8 @@
<p>Set <code>items</code> to any query expression to override the default. If <code>items_model</code> is <em>also</em> specified, lektor-atom applies it as a filter to <code>items</code>.</p> <p>Set <code>items</code> to any query expression to override the default. If <code>items_model</code> is <em>also</em> specified, lektor-atom applies it as a filter to <code>items</code>.</p>
<h2>Use In Templates</h2> <h2>Use In Templates</h2>
<p>You can link to a specific feed in your template. If your <code>atom.ini</code> contains a feed like this:</p> <p>You can link to a specific feed in your template. If your <code>atom.ini</code> contains a feed like this:</p>
<pre lang="ini"><span class="k">[main]</span><span class="w"></span> <pre lang="ini"><span class="k">[main]</span>
<span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/blog</span><span class="w"></span> <span class="na">source_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/blog</span>
</pre> </pre>
<p>Link to the feed in a template like this:</p> <p>Link to the feed in a template like this:</p>
<pre><code>{{ '/blog@atom/main'|url }} <pre><code>{{ '/blog@atom/main'|url }}

View File

@ -139,14 +139,14 @@ enabled a <code>render_disqus_comments</code> function which can render a disqus
box.</p> box.</p>
<h2>Enabling the Plugin</h2> <h2>Enabling the Plugin</h2>
<p>To enable the plugin add this to your project file:</p> <p>To enable the plugin add this to your project file:</p>
<pre lang="shell">$ lektor plugins add lektor-disqus-comments <pre lang="shell">$<span class="w"> </span>lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-disqus-comments
</pre> </pre>
<h2>Configuring the Plugin</h2> <h2>Configuring the Plugin</h2>
<p>The plugin has a config file that is needed to inform it about your <p>The plugin has a config file that is needed to inform it about your
website. Just create a file named <code>disqus-comments.ini</code> into your website. Just create a file named <code>disqus-comments.ini</code> into your
<code>configs/</code> folder and configure the <code>shortname</code> key with the name of <code>configs/</code> folder and configure the <code>shortname</code> key with the name of
your disqus community:</p> your disqus community:</p>
<pre lang="ini"><span class="na">shortname</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">YOUR_SHORTNAME</span><span class="w"></span> <pre lang="ini"><span class="na">shortname</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">YOUR_SHORTNAME</span>
</pre> </pre>
<h2>In Templates</h2> <h2>In Templates</h2>
<p>Now you can add a discussion box to any of your templates by just using <p>Now you can add a discussion box to any of your templates by just using

View File

@ -161,18 +161,18 @@ will always evaluate to a string.</p>
be used display lists of other pages on your site. be used display lists of other pages on your site.
You could create a model definition like this (called, perhaps, You could create a model definition like this (called, perhaps,
<code>models/index.ini</code>):</p> <code>models/index.ini</code>):</p>
<pre lang="ini"><span class="k">[model]</span><span class="w"></span> <pre lang="ini"><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Index Page</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Index Page</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Index: {{ this.title}}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Index: {{ this.title}}</span>
<span class="k">[fields.title]</span><span class="w"></span> <span class="k">[fields.title]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="k">[fields.items]</span><span class="w"></span> <span class="k">[fields.items]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Items</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Items</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">expression</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">expression</span>
<span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Pages to list on this page</span><span class="w"></span> <span class="na">description</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Pages to list on this page</span>
</pre> </pre>
<p>In a particular index page which uses this model, you might set the <p>In a particular index page which uses this model, you might set the
<code>items</code> field to <code>items</code> field to

View File

@ -190,11 +190,11 @@ this will select the minimum of all the timestamps remaining after any filtering
</ul> </ul>
<h2>Examples</h2> <h2>Examples</h2>
<p>Here is a simple example excerpt from a datamodel file:</p> <p>Here is a simple example excerpt from a datamodel file:</p>
<pre lang="ini"><span class="na">&lt;...&gt;</span><span class="w"></span> <pre lang="ini"><span class="na">&lt;...&gt;</span>
<span class="k">[fields.last_mod]</span><span class="w"></span> <span class="k">[fields.last_mod]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Time last modified</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Time last modified</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">gittimestamp</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">gittimestamp</span>
</pre> </pre>
<p>On a page using the above datamodel, so long as the <code>last_mod</code> field <p>On a page using the above datamodel, so long as the <code>last_mod</code> field
is left blank in the <code>contents.lr</code> file, the page modification time is left blank in the <code>contents.lr</code> file, the page modification time
@ -203,18 +203,18 @@ affected that <code>contents.lr</code>. (Or if that file is dirty, the value of
<code>last_mod</code> will be taken from the files filesystem mtime.)</p> <code>last_mod</code> will be taken from the files filesystem mtime.)</p>
<hr> <hr>
<p>Here is a more complicated example which demonstrates the use of all the options.</p> <p>Here is a more complicated example which demonstrates the use of all the options.</p>
<pre lang="ini"><span class="na">&lt;...&gt;</span><span class="w"></span> <pre lang="ini"><span class="na">&lt;...&gt;</span>
<span class="k">[fields.pub_date]</span><span class="w"></span> <span class="k">[fields.pub_date]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Time first published</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Time first published</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">gittimestamp</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">gittimestamp</span>
<span class="na">strategy</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">first</span><span class="w"></span> <span class="na">strategy</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">first</span>
<span class="k">[fields.last_mod]</span><span class="w"></span> <span class="k">[fields.last_mod]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Time last modified</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Time last modified</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">gittimestamp</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">gittimestamp</span>
<span class="na">ignore_commits</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">\[nochange\]</span><span class="w"></span> <span class="na">ignore_commits</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">\[nochange\]</span>
<span class="na">skip_first_commit</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span><span class="w"></span> <span class="na">skip_first_commit</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
</pre> </pre>
<p>This will get the default value of the <code>pub_date</code> field from the <p>This will get the default value of the <code>pub_date</code> field from the
timestamp of the first (earliest) git commit for the source file.</p> timestamp of the first (earliest) git commit for the source file.</p>

View File

@ -140,8 +140,8 @@ include Google-Search code in final HTML fles rendered by Lektor.</p>
<h2>How to Use the plugin ?</h2> <h2>How to Use the plugin ?</h2>
<h3>Enable the plugin</h3> <h3>Enable the plugin</h3>
<p>To enable the plugin, add the following to your <code>.lektorproject</code> file:</p> <p>To enable the plugin, add the following to your <code>.lektorproject</code> file:</p>
<pre lang="ini"><span class="k">[packages]</span><span class="w"></span> <pre lang="ini"><span class="k">[packages]</span>
<span class="na">lektor-google-search</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0.1</span><span class="w"></span> <span class="na">lektor-google-search</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">0.1</span>
</pre> </pre>
<h3>Configure the plugin</h3> <h3>Configure the plugin</h3>
<p>The plugin needs a config file with your <code>search Engine ID</code> code in it</p> <p>The plugin needs a config file with your <code>search Engine ID</code> code in it</p>
@ -149,7 +149,7 @@ include Google-Search code in final HTML fles rendered by Lektor.</p>
<li>Create a file named <code>google-serch.ini</code> into <code>./configs</code> folder in your lektor project's base directory.</li> <li>Create a file named <code>google-serch.ini</code> into <code>./configs</code> folder in your lektor project's base directory.</li>
<li>Put the <code>SEARCH_ENGINE_ID</code> key with the value of your serch engine ID.</li> <li>Put the <code>SEARCH_ENGINE_ID</code> key with the value of your serch engine ID.</li>
</ul> </ul>
<pre lang="ini"><span class="na">SEARCH_ENGINE_ID</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">83892839209432084</span><span class="w"></span> <pre lang="ini"><span class="na">SEARCH_ENGINE_ID</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">83892839209432084</span>
</pre> </pre>
<h3>Usage in template</h3> <h3>Usage in template</h3>
<p>Add Google Search code snippet by calling the function <code>render_google_search()</code> in the template of your preference where you want the search box to appear.</p> <p>Add Google Search code snippet by calling the function <code>render_google_search()</code> in the template of your preference where you want the search box to appear.</p>

View File

@ -160,7 +160,7 @@ All images will be converted to webp using <a href="https://pypi.org/project/Pil
<h2>Installation</h2> <h2>Installation</h2>
<p>To install the plugin, add <code>lektor-image-resize</code> to your plugins from the command line and create a config file:</p> <p>To install the plugin, add <code>lektor-image-resize</code> to your plugins from the command line and create a config file:</p>
<pre lang="bash"><span class="c1"># add the plugin to lektor</span> <pre lang="bash"><span class="c1"># add the plugin to lektor</span>
lektor plugins add lektor-image-resize lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-image-resize
</pre> </pre>
<p>If you have trouble, see the <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">plugin <p>If you have trouble, see the <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">plugin
installation</a> section of the Lektor installation</a> section of the Lektor
@ -169,15 +169,15 @@ documentation.</p>
a few sections for images. The section names can be whatever you want, the a few sections for images. The section names can be whatever you want, the
final images will be called <code>$(imagename)-$(sectionname).jpg</code> and <code>$(imagename)-$(sectionname).webp</code>.</p> final images will be called <code>$(imagename)-$(sectionname).jpg</code> and <code>$(imagename)-$(sectionname).webp</code>.</p>
<p>Here is a example config file:</p> <p>Here is a example config file:</p>
<pre lang="ini"><span class="k">[small]</span><span class="w"></span> <pre lang="ini"><span class="k">[small]</span>
<span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">640</span><span class="w"></span> <span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">640</span>
<span class="na">height</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">360</span><span class="w"></span> <span class="na">height</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">360</span>
<span class="k">[medium]</span><span class="w"></span> <span class="k">[medium]</span>
<span class="na">height</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">720</span><span class="w"></span> <span class="na">height</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">720</span>
<span class="k">[woowee]</span><span class="w"></span> <span class="k">[woowee]</span>
<span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1920</span><span class="w"></span> <span class="na">width</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1920</span>
</pre> </pre>
<p>Will take a file called <code>waffle.jpg</code> and create the files <code>waffle-small.jpg</code>, <p>Will take a file called <code>waffle.jpg</code> and create the files <code>waffle-small.jpg</code>,
<code>waffle-medium.jpg</code> and <code>waffle-woowee.jpg</code> as well as <code>waffle-small.webp</code>, <code>waffle-medium.jpg</code> and <code>waffle-woowee.jpg</code> as well as <code>waffle-small.webp</code>,

View File

@ -149,13 +149,13 @@
<h2>Examples</h2> <h2>Examples</h2>
<p>Querying context: <code>{{ site.get('/').title }}</code> or <code>{{ this.path }}</code></p> <p>Querying context: <code>{{ site.get('/').title }}</code> or <code>{{ this.path }}</code></p>
<p>Logic:</p> <p>Logic:</p>
<pre lang="jinja"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_life</span><span class="o">,</span> <span class="nv">meaning_of_universe</span> <span class="o">=</span> <span class="nv">this.life</span><span class="o">,</span> <span class="nv">this.universe</span> <span class="cp">%}</span><span class="x"></span> <pre lang="jinja"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_life</span><span class="o">,</span> <span class="nv">meaning_of_universe</span> <span class="o">=</span> <span class="nv">this.life</span><span class="o">,</span> <span class="nv">this.universe</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">if</span> <span class="nv">meaning_of_life</span> <span class="o">==</span> <span class="nv">meaning_of_universe</span> <span class="o">==</span> <span class="m">42</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">if</span> <span class="nv">meaning_of_life</span> <span class="o">==</span> <span class="nv">meaning_of_universe</span> <span class="o">==</span> <span class="m">42</span> <span class="cp">%}</span>
<span class="x"> </span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_it_all</span> <span class="o">=</span> <span class="nv">meaning_of_life</span> <span class="cp">%}</span><span class="x"></span> <span class="x"> </span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_it_all</span> <span class="o">=</span> <span class="nv">meaning_of_life</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">else</span> <span class="cp">%}</span>
<span class="x"> </span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_it_all</span> <span class="o">=</span> <span class="s1">&#39;Undefined&#39;</span> <span class="cp">%}</span><span class="x"></span> <span class="x"> </span><span class="cp">{%</span> <span class="k">set</span> <span class="nv">meaning_of_it_all</span> <span class="o">=</span> <span class="s1">&#39;Undefined&#39;</span> <span class="cp">%}</span>
<span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span>
<span class="cp">{{</span> <span class="nv">meaning_of_it_all</span> <span class="cp">}}</span><span class="x"></span> <span class="cp">{{</span> <span class="nv">meaning_of_it_all</span> <span class="cp">}}</span>
</pre> </pre>
<p>Jinja in Markdown:</p> <p>Jinja in Markdown:</p>
<pre lang="jinja"><span class="x">[link text](</span><span class="cp">{{</span> <span class="nv">this</span><span class="o">|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">)</span> <pre lang="jinja"><span class="x">[link text](</span><span class="cp">{{</span> <span class="nv">this</span><span class="o">|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">)</span>

View File

@ -120,7 +120,7 @@
<p>Lektor plugin to run <cite>make lektor</cite> for custom build systems.</p> <p>Lektor plugin to run <cite>make lektor</cite> for custom build systems.</p>
<section id="install"> <section id="install">
<h2>Install</h2> <h2>Install</h2>
<pre><code>python3 -m pip install lektor-make</code></pre> <pre><code>python3<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>lektor-make</code></pre>
</section> </section>

View File

@ -147,7 +147,7 @@
are given anchors and a table of contents is collected.</p> are given anchors and a table of contents is collected.</p>
<h2>Enabling the Plugin</h2> <h2>Enabling the Plugin</h2>
<p>To enable the plugin run this command:</p> <p>To enable the plugin run this command:</p>
<pre lang="shell">$ lektor plugins add markdown-header-anchors <pre lang="shell">$<span class="w"> </span>lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>markdown-header-anchors
</pre> </pre>
<h2>In Templates</h2> <h2>In Templates</h2>
<p>Within templates it becomes possible to access the <code>.toc</code> property of <p>Within templates it becomes possible to access the <code>.toc</code> property of
@ -160,10 +160,10 @@ markdown data. It's a list where each item has the following attributes:</p>
<p>Example rendering:</p> <p>Example rendering:</p>
<pre lang="jinja"><span class="x">&lt;h4&gt;Table Of Contents&lt;/h4&gt;</span> <pre lang="jinja"><span class="x">&lt;h4&gt;Table Of Contents&lt;/h4&gt;</span>
<span class="x">&lt;ul class=&quot;toc&quot;&gt;</span> <span class="x">&lt;ul class=&quot;toc&quot;&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">item</span> <span class="k">in</span> <span class="nv">this.body.toc</span> <span class="k">recursive</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">for</span> <span class="nv">item</span> <span class="k">in</span> <span class="nv">this.body.toc</span> <span class="k">recursive</span> <span class="cp">%}</span>
<span class="x"> &lt;li&gt;&lt;a href=&quot;#</span><span class="cp">{{</span> <span class="nv">item.anchor</span> <span class="cp">}}</span><span class="x">&quot;&gt;</span><span class="cp">{{</span> <span class="nv">item.title</span> <span class="cp">}}</span><span class="x">&lt;/a&gt;</span><span class="cp">{%</span> <span class="x"> &lt;li&gt;&lt;a href=&quot;#</span><span class="cp">{{</span> <span class="nv">item.anchor</span> <span class="cp">}}</span><span class="x">&quot;&gt;</span><span class="cp">{{</span> <span class="nv">item.title</span> <span class="cp">}}</span><span class="x">&lt;/a&gt;</span><span class="cp">{%</span>
<span class="k">if</span> <span class="nv">item.children</span> <span class="cp">%}</span><span class="x">&lt;ul&gt;</span><span class="cp">{{</span> <span class="nb">loop</span><span class="o">(</span><span class="nv">item.children</span><span class="o">)</span> <span class="cp">}}</span><span class="x">&lt;/ul&gt;</span><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="x">&lt;/li&gt;</span> <span class="k">if</span> <span class="nv">item.children</span> <span class="cp">%}</span><span class="x">&lt;ul&gt;</span><span class="cp">{{</span> <span class="nb">loop</span><span class="o">(</span><span class="nv">item.children</span><span class="o">)</span> <span class="cp">}}</span><span class="x">&lt;/ul&gt;</span><span class="cp">{%</span> <span class="k">endif</span> <span class="cp">%}</span><span class="x">&lt;/li&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="x">&lt;/ul&gt;</span> <span class="x">&lt;/ul&gt;</span>
</pre> </pre>

View File

@ -141,14 +141,14 @@
Lektor's markdown support.</p> Lektor's markdown support.</p>
<h2>Enabling the Plugin</h2> <h2>Enabling the Plugin</h2>
<p>To enable the plugin run this command:</p> <p>To enable the plugin run this command:</p>
<pre lang="shell">lektor plugins add markdown-highlighter <pre lang="shell">lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>markdown-highlighter
</pre> </pre>
<h2>Configuring the Plugin</h2> <h2>Configuring the Plugin</h2>
<p>The plugin has a config file that is used to configure a few things <p>The plugin has a config file that is used to configure a few things
for Pygments. Just create a file named <code>markdown-highlighter.ini</code> into your for Pygments. Just create a file named <code>markdown-highlighter.ini</code> into your
<code>configs/</code> folder. Currently only <code>pygments.style</code> is used:</p> <code>configs/</code> folder. Currently only <code>pygments.style</code> is used:</p>
<pre lang="ini"><span class="k">[pygments]</span><span class="w"></span> <pre lang="ini"><span class="k">[pygments]</span>
<span class="na">style</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">tango</span><span class="w"></span> <span class="na">style</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">tango</span>
</pre> </pre>
<p>You can use this to select any of the built-in Pygments styles. Support for <p>You can use this to select any of the built-in Pygments styles. Support for
custom styles will come in the future.</p> custom styles will come in the future.</p>
@ -167,7 +167,7 @@ can be used to generate and retrieve a link to the pygments stylesheet:</p>
</pre> </pre>
<p>In addition the <code>|pygmentize</code> filter can be used to highlight code from <p>In addition the <code>|pygmentize</code> filter can be used to highlight code from
templates. It takes one argument which is the lexer name:</p> templates. It takes one argument which is the lexer name:</p>
<pre lang="jinja"><span class="cp">{{</span> <span class="s1">&#39;print &quot;Hello World!&quot;&#39;</span><span class="o">|</span><span class="nf">pygmentize</span><span class="o">(</span><span class="s1">&#39;python&#39;</span><span class="o">)</span> <span class="cp">}}</span><span class="x"></span> <pre lang="jinja"><span class="cp">{{</span> <span class="s1">&#39;print &quot;Hello World!&quot;&#39;</span><span class="o">|</span><span class="nf">pygmentize</span><span class="o">(</span><span class="s1">&#39;python&#39;</span><span class="o">)</span> <span class="cp">}}</span>
</pre> </pre>

View File

@ -132,14 +132,14 @@
<h2>Installation</h2> <h2>Installation</h2>
<p>Install the <code>netlify</code> command-line program according to <a href="https://www.netlify.com/docs/cli" rel="nofollow">the instructions on netlify.com</a>.</p> <p>Install the <code>netlify</code> command-line program according to <a href="https://www.netlify.com/docs/cli" rel="nofollow">the instructions on netlify.com</a>.</p>
<p>Add lektor-netlify to your project from the command line:</p> <p>Add lektor-netlify to your project from the command line:</p>
<pre lang="shell">lektor plugins add lektor-netlify <pre lang="shell">lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-netlify
</pre> </pre>
<p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p> <p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p>
<h2>Configuration</h2> <h2>Configuration</h2>
<p>Configure a server in your <code>.lektorproject</code> file:</p> <p>Configure a server in your <code>.lektorproject</code> file:</p>
<pre lang="ini"><span class="k">[servers.production]</span><span class="w"></span> <pre lang="ini"><span class="k">[servers.production]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Production</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Production</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">netlify://my-domain.com</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">netlify://my-domain.com</span>
</pre> </pre>
<h2>Access Token</h2> <h2>Access Token</h2>
<p>Get a personal access token from Netlify's &quot;applications&quot; page:</p> <p>Get a personal access token from Netlify's &quot;applications&quot; page:</p>
@ -147,16 +147,16 @@
<li><a href="https://app.netlify.com/applications" rel="nofollow">Applications</a></li> <li><a href="https://app.netlify.com/applications" rel="nofollow">Applications</a></li>
</ul> </ul>
<p>You must use this access token each time you publish. <strong>If your project file is private</strong> you can save the token there. Do not commit this!</p> <p>You must use this access token each time you publish. <strong>If your project file is private</strong> you can save the token there. Do not commit this!</p>
<pre lang="ini"><span class="k">[servers.production]</span><span class="w"></span> <pre lang="ini"><span class="k">[servers.production]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Production</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Production</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">netlify://my-domain.com</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">netlify://my-domain.com</span>
<span class="na">key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ACCESS_TOKEN</span><span class="w"></span> <span class="na">key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">ACCESS_TOKEN</span>
</pre> </pre>
<p>Now deploy your site like:</p> <p>Now deploy your site like:</p>
<pre lang="shell">lektor deploy production <pre lang="shell">lektor<span class="w"> </span>deploy<span class="w"> </span>production
</pre> </pre>
<p>Otherwise, pass the token on the command line:</p> <p>Otherwise, pass the token on the command line:</p>
<pre lang="shell">lektor deploy production --key ACCESS_TOKEN <pre lang="shell">lektor<span class="w"> </span>deploy<span class="w"> </span>production<span class="w"> </span>--key<span class="w"> </span>ACCESS_TOKEN<span class="w"> </span>
</pre> </pre>

View File

@ -158,16 +158,16 @@
<p><code>lektor-npm-support</code> makes it easy to use <a href="https://parcel.js.org" rel="nofollow">Parcel</a>, <a href="https://webpack.js.org" rel="nofollow">webpack</a>, <a href="http://browserify.org/" rel="nofollow">browserify</a>, or any other tool to build assets for <a href="https://github.com/lektor/lektor" rel="nofollow">Lektor</a> projects.</p> <p><code>lektor-npm-support</code> makes it easy to use <a href="https://parcel.js.org" rel="nofollow">Parcel</a>, <a href="https://webpack.js.org" rel="nofollow">webpack</a>, <a href="http://browserify.org/" rel="nofollow">browserify</a>, or any other tool to build assets for <a href="https://github.com/lektor/lektor" rel="nofollow">Lektor</a> projects.</p>
<h2>Enabling the Plugin</h2> <h2>Enabling the Plugin</h2>
<p>To enable the plugin, run this command while inside your Lektor project directory:</p> <p>To enable the plugin, run this command while inside your Lektor project directory:</p>
<pre lang="bash">lektor plugins add lektor-npm-support <pre lang="bash">lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-npm-support
</pre> </pre>
<h2>Example: Creating a <a href="https://parceljs.org/" rel="nofollow">Parcel</a> Project</h2> <h2>Example: Creating a <a href="https://parceljs.org/" rel="nofollow">Parcel</a> Project</h2>
<p>Create a <code>parcel/</code> folder and inside that folder create the following files:</p> <p>Create a <code>parcel/</code> folder and inside that folder create the following files:</p>
<h3><code>configs/npm-support.ini</code></h3> <h3><code>configs/npm-support.ini</code></h3>
<p>This file instructs the plugin how to generate the assets:</p> <p>This file instructs the plugin how to generate the assets:</p>
<pre lang="ini"><span class="k">[parcel]</span><span class="w"></span> <pre lang="ini"><span class="k">[parcel]</span>
<span class="na">npm</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yarn</span><span class="w"></span> <span class="na">npm</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yarn</span>
<span class="na">watch_script</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">watch</span><span class="w"></span> <span class="na">watch_script</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">watch</span>
<span class="na">build_script</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">build</span><span class="w"></span> <span class="na">build_script</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">build</span>
</pre> </pre>
<ul> <ul>
<li>The section name <code>[parcel]</code> is the name of the folder where the Parcel project is located.</li> <li>The section name <code>[parcel]</code> is the name of the folder where the Parcel project is located.</li>
@ -178,15 +178,15 @@
<p>This plugin supports more than one such entry.</p> <p>This plugin supports more than one such entry.</p>
<h3><code>parcel/package.json</code></h3> <h3><code>parcel/package.json</code></h3>
<p>This is a standard <code>package.json</code> file. It should contain two entries in the <code>scripts</code> section. The <code>build</code> script is used during <code>lektor build -f npm</code>, and the <code>watch</code> script is used during <code>lektor server -f npm</code>.</p> <p>This is a standard <code>package.json</code> file. It should contain two entries in the <code>scripts</code> section. The <code>build</code> script is used during <code>lektor build -f npm</code>, and the <code>watch</code> script is used during <code>lektor server -f npm</code>.</p>
<pre lang="json"><span class="p">{</span><span class="w"></span> <pre lang="json"><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;my-parcel-project&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;my-parcel-project&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;1.0.0&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;1.0.0&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;scripts&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;scripts&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;watch&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;NODE_ENV=development parcel --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;watch&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;NODE_ENV=development parcel --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;build&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;NODE_ENV=production parcel build --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js&quot;</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;build&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;NODE_ENV=production parcel build --out-dir=../assets/static/gen --out-file=main.js --public-url=./assets/ main.js&quot;</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nt">&quot;private&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;private&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span>
<span class="p">}</span><span class="w"></span> <span class="p">}</span>
</pre> </pre>
<p>Now we can use <code>yarn add</code> to add Parcel, <a href="https://babeljs.io/" rel="nofollow">Babel</a> and <a href="https://sass-lang.com/" rel="nofollow">Sass</a>:</p> <p>Now we can use <code>yarn add</code> to add Parcel, <a href="https://babeljs.io/" rel="nofollow">Babel</a> and <a href="https://sass-lang.com/" rel="nofollow">Sass</a>:</p>
<pre><code>$ cd &lt;/path/to/your/lektor/project&gt;/parcel <pre><code>$ cd &lt;/path/to/your/lektor/project&gt;/parcel
@ -194,19 +194,19 @@ $ yarn add parcel-bundler babel-preset-env node-sass
</code></pre> </code></pre>
<h3><code>parcel/babelr.rc</code></h3> <h3><code>parcel/babelr.rc</code></h3>
<p>Next up is a simple Babel config file, using the recommended <code>env</code> preset.</p> <p>Next up is a simple Babel config file, using the recommended <code>env</code> preset.</p>
<pre lang="json"><span class="p">{</span><span class="w"></span> <pre lang="json"><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;presets&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;env&quot;</span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;presets&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;env&quot;</span><span class="p">]</span>
<span class="p">}</span><span class="w"></span> <span class="p">}</span>
</pre> </pre>
<h3><code>parcel/main.scss</code></h3> <h3><code>parcel/main.scss</code></h3>
<p>A simple SCSS file.</p> <p>A simple SCSS file.</p>
<pre lang="scss"><span class="nt">body</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <pre lang="scss"><span class="nt">body</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nt">border</span><span class="nd">:</span><span class="w"> </span><span class="nt">10px</span><span class="w"> </span><span class="nt">solid</span><span class="w"> </span><span class="nt">red</span><span class="o">;</span><span class="w"></span> <span class="w"> </span><span class="nt">border</span><span class="nd">:</span><span class="w"> </span><span class="nt">10px</span><span class="w"> </span><span class="nt">solid</span><span class="w"> </span><span class="nt">red</span><span class="o">;</span>
<span class="p">}</span><span class="w"></span> <span class="p">}</span>
</pre> </pre>
<h3><code>parcel/main.js</code></h3> <h3><code>parcel/main.js</code></h3>
<p>A simple Javascript file that imports the SCSS file so that Parcel will know to include it as well.</p> <p>A simple Javascript file that imports the SCSS file so that Parcel will know to include it as well.</p>
<pre lang="javascript"><span class="k">import</span><span class="w"> </span><span class="s1">&#39;./main.scss&#39;</span><span class="p">;</span><span class="w"></span> <pre lang="javascript"><span class="k">import</span><span class="w"> </span><span class="s1">&#39;./main.scss&#39;</span><span class="p">;</span>
</pre> </pre>
<h2>Running the Server</h2> <h2>Running the Server</h2>
<p>Now you're ready to go. When you run <code>lektor server</code> nothing wil happen, <p>Now you're ready to go. When you run <code>lektor server</code> nothing wil happen,

View File

@ -150,45 +150,45 @@ with “<code>_type</code>” appended.</p>
<h2>Examples</h2> <h2>Examples</h2>
<h3>Simple Example</h3> <h3>Simple Example</h3>
<p>Here is an example model file for a simple page, with a selectable body format:</p> <p>Here is an example model file for a simple page, with a selectable body format:</p>
<pre lang="ini"><span class="c1"># page.ini</span><span class="w"></span> <pre lang="ini"><span class="c1"># page.ini</span>
<span class="k">[model]</span><span class="w"></span> <span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Page</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Page</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span>
<span class="k">[fields.title]</span><span class="w"></span> <span class="k">[fields.title]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="k">[fields.body]</span><span class="w"></span> <span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">polymorphic</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">polymorphic</span>
<span class="k">[fields.body_type]</span><span class="w"></span> <span class="k">[fields.body_type]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body Type</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body Type</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">select</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">select</span>
<span class="na">choices</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown, html, text</span><span class="w"></span> <span class="na">choices</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown, html, text</span>
<span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span><span class="w"></span> <span class="na">default</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">markdown</span>
</pre> </pre>
<p>Here, the value of the <code>body_type</code> field on a particular page will <p>Here, the value of the <code>body_type</code> field on a particular page will
determine whether the <code>body</code> field is interpreted as being <code>markdown</code>, determine whether the <code>body</code> field is interpreted as being <code>markdown</code>,
<code>html</code> or <code>text</code>.</p> <code>html</code> or <code>text</code>.</p>
<h3>Contrived Example</h3> <h3>Contrived Example</h3>
<p>Here is a contrived example showing the use of the <code>polymorphic_type</code> option:</p> <p>Here is a contrived example showing the use of the <code>polymorphic_type</code> option:</p>
<pre lang="ini"><span class="c1"># page.ini</span><span class="w"></span> <pre lang="ini"><span class="c1"># page.ini</span>
<span class="k">[model]</span><span class="w"></span> <span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Page</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Page</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.title }}</span>
<span class="k">[fields.title]</span><span class="w"></span> <span class="k">[fields.title]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Title</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">string</span>
<span class="k">[fields.body]</span><span class="w"></span> <span class="k">[fields.body]</span>
<span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span><span class="w"></span> <span class="na">label</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Body</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">polymorphic</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">polymorphic</span>
<span class="na">polymorphic_type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&#39;html&#39; if this.body.lstrip().startswith(&#39;&lt;&#39;) else &#39;markdown&#39;</span><span class="w"></span> <span class="na">polymorphic_type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&#39;html&#39; if this.body.lstrip().startswith(&#39;&lt;&#39;) else &#39;markdown&#39;</span>
</pre> </pre>
<p>In this case, the <code>body</code> field will be interpreted as raw HTML if the <p>In this case, the <code>body</code> field will be interpreted as raw HTML if the
content of that field starts with a “<code>&lt;</code>”, otherwise it will be content of that field starts with a “<code>&lt;</code>”, otherwise it will be

View File

@ -148,26 +148,26 @@
<p>Press Enter and lektor will automatically download and install this plugin for you.</p> <p>Press Enter and lektor will automatically download and install this plugin for you.</p>
<h2>Usage</h2> <h2>Usage</h2>
<p>After Installation, open your lektorproject file, first it should have a section like this:</p> <p>After Installation, open your lektorproject file, first it should have a section like this:</p>
<pre lang="ini"><span class="k">[packages]</span><span class="w"></span> <pre lang="ini"><span class="k">[packages]</span>
<span class="na">lektor-qiniu</span><span class="o">=</span><span class="w"> </span><span class="s">0.1.3</span><span class="w"></span> <span class="na">lektor-qiniu</span><span class="o">=</span><span class="w"> </span><span class="s">0.1.3</span>
</pre> </pre>
<p>then below this section, you need add your bucket and folder(optional) as a target of a deploy server, like this:</p> <p>then below this section, you need add your bucket and folder(optional) as a target of a deploy server, like this:</p>
<pre lang="ini"><span class="k">[servers.qiniu]</span><span class="w"></span> <pre lang="ini"><span class="k">[servers.qiniu]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu://&lt;YOUR-BUCKET&gt;</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu://&lt;YOUR-BUCKET&gt;</span>
</pre> </pre>
<p>or if you want deploy your site to a folder in a bucket, mostly for backups, you can add server section as below:</p> <p>or if you want deploy your site to a folder in a bucket, mostly for backups, you can add server section as below:</p>
<pre lang="ini"><span class="k">[servers.qiniu]</span><span class="w"></span> <pre lang="ini"><span class="k">[servers.qiniu]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu://&lt;YOUR-BUCKET&gt;/&lt;NAME-OF-FOLDER&gt;</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu://&lt;YOUR-BUCKET&gt;/&lt;NAME-OF-FOLDER&gt;</span>
</pre> </pre>
<p>for example, if you want to deploy your site to a bucket name &quot;abcde&quot;, folder &quot;fjhi&quot;, you will need to add a server section as below:</p> <p>for example, if you want to deploy your site to a bucket name &quot;abcde&quot;, folder &quot;fjhi&quot;, you will need to add a server section as below:</p>
<pre lang="ini"><span class="k">[servers.qiniu]</span><span class="w"></span> <pre lang="ini"><span class="k">[servers.qiniu]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu://abcde/fjhi</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">qiniu://abcde/fjhi</span>
</pre> </pre>
<p>after this you should see a server shows when you push the deploy button in your Lektor Admin Dashboard.</p> <p>after this you should see a server shows when you push the deploy button in your Lektor Admin Dashboard.</p>
<p>but still you will need just 5 minutes to configure this plugin to make it works.</p> <p>but still you will need just 5 minutes to configure this plugin to make it works.</p>
@ -177,16 +177,16 @@
<p>In configs folder, create a configuration file exactly named <strong>qiniu.ini</strong>.</p> <p>In configs folder, create a configuration file exactly named <strong>qiniu.ini</strong>.</p>
<h4>Attention: DO NOT name the configuration file with other names, otherwise this plugin will not work properly.</h4> <h4>Attention: DO NOT name the configuration file with other names, otherwise this plugin will not work properly.</h4>
<p>In this configuration file, you will need add few more sections, you can copy a sample configuration ini file from the sample_config folder, it looks like this:</p> <p>In this configuration file, you will need add few more sections, you can copy a sample configuration ini file from the sample_config folder, it looks like this:</p>
<pre lang="ini"><span class="k">[auth]</span><span class="w"></span> <pre lang="ini"><span class="k">[auth]</span>
<span class="na">Access_Key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">replace_with_your_own_AK</span><span class="w"></span> <span class="na">Access_Key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">replace_with_your_own_AK</span>
<span class="na">Secret_Key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">replace_with_your_won_SK</span><span class="w"></span> <span class="na">Secret_Key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">replace_with_your_won_SK</span>
<span class="k">[cdn]</span><span class="w"></span> <span class="k">[cdn]</span>
<span class="na">refresh_enable</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">refresh_enable</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">refresh_url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://www.your-own-site.com/</span><span class="w"></span> <span class="na">refresh_url</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">https://www.your-own-site.com/</span>
<span class="k">[exclusions]</span><span class="w"></span> <span class="k">[exclusions]</span>
<span class="na">dirs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">.lektor</span><span class="w"></span> <span class="na">dirs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">.lektor</span>
<span class="na">files</span><span class="w"> </span><span class="o">=</span><span class="w"> </span> <span class="na">files</span><span class="w"> </span><span class="o">=</span><span class="w"> </span>
</pre> </pre>
<h4>Credentials</h4> <h4>Credentials</h4>
@ -197,9 +197,9 @@
<h4>exclusions</h4> <h4>exclusions</h4>
<p>Another function this plugin provides is exclude folders or files you want to upload during deployment.</p> <p>Another function this plugin provides is exclude folders or files you want to upload during deployment.</p>
<p>To exclude files or folders, just put the name of the folders or files in the <strong>exclusions</strong> section of configuration file, separated each one with commas.</p> <p>To exclude files or folders, just put the name of the folders or files in the <strong>exclusions</strong> section of configuration file, separated each one with commas.</p>
<pre lang="ini"><span class="k">[exclusions]</span><span class="w"></span> <pre lang="ini"><span class="k">[exclusions]</span>
<span class="na">dirs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">.lektor, dir1, dir2</span><span class="w"></span> <span class="na">dirs</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">.lektor, dir1, dir2</span>
<span class="na">files</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">file1, file2,file3</span><span class="w"></span> <span class="na">files</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">file1, file2,file3</span>
</pre> </pre>
<p>One special folder here is <strong>.lektor</strong>, which Lektor officially suggests that this folder should be exclude during deployment, therefore you should keep at least this one, unless you have other needs for this folder.</p> <p>One special folder here is <strong>.lektor</strong>, which Lektor officially suggests that this folder should be exclude during deployment, therefore you should keep at least this one, unless you have other needs for this folder.</p>
<h3>About Lektor CMS</h3> <h3>About Lektor CMS</h3>

View File

@ -152,14 +152,14 @@ Remember to do this <strong>first</strong> because lektor-s3 won't do it automat
<p>You should see a message saying lektor-s3 has been added to the project.</p> <p>You should see a message saying lektor-s3 has been added to the project.</p>
<p>Next, add an S3 bucket to your project's servers. In your project file <p>Next, add an S3 bucket to your project's servers. In your project file
(like <code>blog.lektorproject</code>), add the following:</p> (like <code>blog.lektorproject</code>), add the following:</p>
<pre lang="ini"><span class="k">[servers.s3]</span><span class="w"></span> <pre lang="ini"><span class="k">[servers.s3]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">S3</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">S3</span>
<span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span><span class="w"></span> <span class="na">enabled</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">yes</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">s3://&lt;YOUR-BUCKET&gt;</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">s3://&lt;YOUR-BUCKET&gt;</span>
</pre> </pre>
<p>For example, if you wanted to deploy to a bucket named 'huntedwumpus', <p>For example, if you wanted to deploy to a bucket named 'huntedwumpus',
you'd make that last line</p> you'd make that last line</p>
<pre lang="ini"><span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">s3://huntedwumpus</span><span class="w"></span> <pre lang="ini"><span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">s3://huntedwumpus</span>
</pre> </pre>
<p>Now, if you call <code>lektor deploy s3</code>, Lektor will upload your built <p>Now, if you call <code>lektor deploy s3</code>, Lektor will upload your built
website to S3 in the bucket you targeted.</p> website to S3 in the bucket you targeted.</p>
@ -167,7 +167,7 @@ website to S3 in the bucket you targeted.</p>
<p>Optionally, you can also provide a <a href="https://aws.amazon.com/cloudfront/" rel="nofollow">CloudFront</a> <p>Optionally, you can also provide a <a href="https://aws.amazon.com/cloudfront/" rel="nofollow">CloudFront</a>
distribution ID. If you do, Lektor will invalidate all objects in that CloudFront distribution ID. If you do, Lektor will invalidate all objects in that CloudFront
distribution after every deploy.</p> distribution after every deploy.</p>
<pre lang="ini"><span class="na">cloudfront</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;YOUR-DISTRIBUTION-ID&gt;</span><span class="w"></span> <pre lang="ini"><span class="na">cloudfront</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;YOUR-DISTRIBUTION-ID&gt;</span>
</pre> </pre>
<h2>Credentials</h2> <h2>Credentials</h2>
<p>You need to prove to S3 that you have permission to upload to the <p>You need to prove to S3 that you have permission to upload to the
@ -181,16 +181,16 @@ and <code>AWS_SECRET_ACCESS_KEY</code>.</p>
<p>If you have multiple sets of credentials, you can group them into profiles in <p>If you have multiple sets of credentials, you can group them into profiles in
your credentials file and choose the right one using the <code>AWS_PROFILE</code> your credentials file and choose the right one using the <code>AWS_PROFILE</code>
environment variable. Your <code>~/.aws/credenials</code> file might look like this:</p> environment variable. Your <code>~/.aws/credenials</code> file might look like this:</p>
<pre lang="ini"><span class="k">[work]</span><span class="w"></span> <pre lang="ini"><span class="k">[work]</span>
<span class="na">aws_access_key_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;...&gt;</span><span class="w"></span> <span class="na">aws_access_key_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;...&gt;</span>
<span class="na">aws_secret_access_key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;...&gt;</span><span class="w"></span> <span class="na">aws_secret_access_key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;...&gt;</span>
<span class="k">[personal]</span><span class="w"></span> <span class="k">[personal]</span>
<span class="na">aws_access_key_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;...&gt;</span><span class="w"></span> <span class="na">aws_access_key_id</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;...&gt;</span>
<span class="na">aws_secret_access_key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;...&gt;</span><span class="w"></span> <span class="na">aws_secret_access_key</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&lt;...&gt;</span>
</pre> </pre>
<p>And then you can invoke <code>lektor</code> with the environment variable:</p> <p>And then you can invoke <code>lektor</code> with the environment variable:</p>
<pre lang="console"><span class="gp">$ </span><span class="nv">AWS_PROFILE</span><span class="o">=</span>personal lektor deploy<span class="sb">`</span> <pre lang="console"><span class="gp">$ </span><span class="nv">AWS_PROFILE</span><span class="o">=</span>personal<span class="w"> </span>lektor<span class="w"> </span>deploy<span class="sb">`</span>
</pre> </pre>
<h2>Configuration</h2> <h2>Configuration</h2>
<p>You can specify headers to be attached to particular files when uploading them <p>You can specify headers to be attached to particular files when uploading them
@ -208,24 +208,24 @@ their values. A list of valid headers is defined in the boto documentation as
<a href="https://boto3.readthedocs.io/en/latest/reference/customizations/s3.html#boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS" rel="nofollow"><code>ALLOWED_UPLOAD_ARGS</code></a>.</p> <a href="https://boto3.readthedocs.io/en/latest/reference/customizations/s3.html#boto3.s3.transfer.S3Transfer.ALLOWED_UPLOAD_ARGS" rel="nofollow"><code>ALLOWED_UPLOAD_ARGS</code></a>.</p>
<p>Defaults can be defined via the usual INI file way, in a <code>[DEFAULTS]</code> section.</p> <p>Defaults can be defined via the usual INI file way, in a <code>[DEFAULTS]</code> section.</p>
<p>For example, your configuration file might look like this:</p> <p>For example, your configuration file might look like this:</p>
<pre lang="ini"><span class="k">[DEFAULT]</span><span class="w"></span> <pre lang="ini"><span class="k">[DEFAULT]</span>
<span class="na">CacheControl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">public,max-age=3600</span><span class="w"></span> <span class="na">CacheControl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">public,max-age=3600</span>
<span class="k">[static files]</span><span class="w"></span> <span class="k">[static files]</span>
<span class="na">match</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">\.(css|js|woff|woff2)$</span><span class="w"></span> <span class="na">match</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">\.(css|js|woff|woff2)$</span>
<span class="na">CacheControl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">public,max-age=31536000</span><span class="w"></span> <span class="na">CacheControl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">public,max-age=31536000</span>
<span class="k">[media]</span><span class="w"></span> <span class="k">[media]</span>
<span class="na">extensions</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">jpg,jpeg,png,mp4</span><span class="w"></span> <span class="na">extensions</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">jpg,jpeg,png,mp4</span>
<span class="na">CacheControl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">public,max-age=259200</span><span class="w"></span> <span class="na">CacheControl</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">public,max-age=259200</span>
<span class="k">[fonts]</span><span class="w"></span> <span class="k">[fonts]</span>
<span class="na">extensions</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">woff2</span><span class="w"></span> <span class="na">extensions</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">woff2</span>
<span class="na">ContentType</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">application/font-woff2</span><span class="w"></span> <span class="na">ContentType</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">application/font-woff2</span>
<span class="k">[documents]</span><span class="w"></span> <span class="k">[documents]</span>
<span class="na">extensions</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">html,txt</span><span class="w"></span> <span class="na">extensions</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">html,txt</span>
<span class="na">ContentLanguage</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">en</span><span class="w"></span> <span class="na">ContentLanguage</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">en</span>
</pre> </pre>
<h2>Contributing</h2> <h2>Contributing</h2>
<p>Pull requests are super useful and encouraged! Once accepted, changes <p>Pull requests are super useful and encouraged! Once accepted, changes

View File

@ -151,26 +151,26 @@
</ul> </ul>
<h2>Installation</h2> <h2>Installation</h2>
<p>You can install the plugin with Lektor's installer:</p> <p>You can install the plugin with Lektor's installer:</p>
<pre lang="bash">lektor plugins add lektor-scss <pre lang="bash">lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-scss
</pre> </pre>
<p>Or by hand, adding the plugin to the packages section in your lektorproject file:</p> <p>Or by hand, adding the plugin to the packages section in your lektorproject file:</p>
<pre lang="ini"><span class="k">[packages]</span><span class="w"></span> <pre lang="ini"><span class="k">[packages]</span>
<span class="na">lektor-scss</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1.4.1</span><span class="w"></span> <span class="na">lektor-scss</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">1.4.1</span>
</pre> </pre>
<h2>Usage</h2> <h2>Usage</h2>
<p>To enable the plugin, pass the <code>scss</code> flag when starting the development <p>To enable the plugin, pass the <code>scss</code> flag when starting the development
server or when running a build:</p> server or when running a build:</p>
<pre lang="bash"><span class="c1"># build and compile css from scss</span> <pre lang="bash"><span class="c1"># build and compile css from scss</span>
lektor build -f scss lektor<span class="w"> </span>build<span class="w"> </span>-f<span class="w"> </span>scss
<span class="c1"># edit site with new generated css</span> <span class="c1"># edit site with new generated css</span>
lektor server -f scss lektor<span class="w"> </span>server<span class="w"> </span>-f<span class="w"> </span>scss
</pre> </pre>
<h2>Python3</h2> <h2>Python3</h2>
<p>It is highly recommended to use this plugin with a python3 version of lektor.</p> <p>It is highly recommended to use this plugin with a python3 version of lektor.</p>
<p>Since lektor can be used as a python module it is possible to enforce this <em>(after lektor is installed eg. with <code>pip3 install --user --upgrade lektor</code>)</em> with the following command:</p> <p>Since lektor can be used as a python module it is possible to enforce this <em>(after lektor is installed eg. with <code>pip3 install --user --upgrade lektor</code>)</em> with the following command:</p>
<pre lang="bash"><span class="c1"># run a python3 lektor server with new generated css</span> <pre lang="bash"><span class="c1"># run a python3 lektor server with new generated css</span>
python3 -m lektor server -f scss python3<span class="w"> </span>-m<span class="w"> </span>lektor<span class="w"> </span>server<span class="w"> </span>-f<span class="w"> </span>scss
</pre> </pre>
<h2>Configuration</h2> <h2>Configuration</h2>
<p>The Plugin has the following settings you can adjust to your needs:</p> <p>The Plugin has the following settings you can adjust to your needs:</p>

View File

@ -146,19 +146,19 @@
compiling them as part of the build process. It only rebuilds when it's needed (file changed, a file it imports changed or the config changed). When starting the the development server it watchs the files for changes in the background and rebuilds them when needed.</p> compiling them as part of the build process. It only rebuilds when it's needed (file changed, a file it imports changed or the config changed). When starting the the development server it watchs the files for changes in the background and rebuilds them when needed.</p>
<h2>Installing</h2> <h2>Installing</h2>
<p>You can install the plugin with Lektor's installer::</p> <p>You can install the plugin with Lektor's installer::</p>
<pre lang="bash">lektor plugins add lektor-scsscompile <pre lang="bash">lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-scsscompile
</pre> </pre>
<p>Or by hand, adding the plugin to the packages section in your lektorproject file::</p> <p>Or by hand, adding the plugin to the packages section in your lektorproject file::</p>
<pre lang="bash"><span class="o">[</span>packages<span class="o">]</span> <pre lang="bash"><span class="o">[</span>packages<span class="o">]</span>
lektor-scsscompile <span class="o">=</span> <span class="m">1</span>.3.0 lektor-scsscompile<span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="m">1</span>.3.0
</pre> </pre>
<h2>Usage</h2> <h2>Usage</h2>
<h5></h5> <h5></h5>
<p>To enable scsscompile, pass the <code>scsscompile</code> flag when starting the development <p>To enable scsscompile, pass the <code>scsscompile</code> flag when starting the development
server or when running a build::</p> server or when running a build::</p>
<pre lang="bash">lektor build -f scsscompile <pre lang="bash">lektor<span class="w"> </span>build<span class="w"> </span>-f<span class="w"> </span>scsscompile
</pre> </pre>
<pre lang="bash">lektor build -f scsscompile <pre lang="bash">lektor<span class="w"> </span>build<span class="w"> </span>-f<span class="w"> </span>scsscompile
</pre> </pre>
<p>The Plugin has the following settings you can adjust to your needs:</p> <p>The Plugin has the following settings you can adjust to your needs:</p>
<table> <table>

View File

@ -131,8 +131,8 @@
<p>This is a simple Lektor plugin that creates a template filter to remove HTML tags from a string. The use it was created for was to do processing on HTML outputted from a Markdown content field. The Markdown is rendered into HTML, and this filter can turn that into simple text, which was then passed to the <a href="https://github.com/terminal-labs/lektor-natural-language" rel="nofollow">lektor-natural-language</a> filters to get keywords, unsullied by things like <code>&lt;div&gt;</code> tags.</p> <p>This is a simple Lektor plugin that creates a template filter to remove HTML tags from a string. The use it was created for was to do processing on HTML outputted from a Markdown content field. The Markdown is rendered into HTML, and this filter can turn that into simple text, which was then passed to the <a href="https://github.com/terminal-labs/lektor-natural-language" rel="nofollow">lektor-natural-language</a> filters to get keywords, unsullied by things like <code>&lt;div&gt;</code> tags.</p>
<p>Example usage:</p> <p>Example usage:</p>
<p><code>{{ this.body|striphtmltags }}</code></p> <p><code>{{ this.body|striphtmltags }}</code></p>
<pre lang="jinja"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">var</span> <span class="o">=</span> <span class="s1">&#39;&lt;p&gt;&lt;strong&gt;Hello&lt;/strong&gt;World!&lt;/p&gt;&#39;</span> <span class="cp">%}</span><span class="x"></span> <pre lang="jinja"><span class="cp">{%</span> <span class="k">set</span> <span class="nv">var</span> <span class="o">=</span> <span class="s1">&#39;&lt;p&gt;&lt;strong&gt;Hello&lt;/strong&gt;World!&lt;/p&gt;&#39;</span> <span class="cp">%}</span>
<span class="cp">{{</span> <span class="nv">var</span><span class="o">|</span><span class="nf">striphtmltags</span> <span class="cp">}}</span><span class="x"></span> <span class="cp">{{</span> <span class="nv">var</span><span class="o">|</span><span class="nf">striphtmltags</span> <span class="cp">}}</span>
</pre> </pre>
<p>The last example will render as &quot;Hello World!&quot;</p> <p>The last example will render as &quot;Hello World!&quot;</p>

View File

@ -136,12 +136,12 @@
<p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p> <p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p>
<h2>Configuration</h2> <h2>Configuration</h2>
<p>Configure Surge in your <code>.lektorproject</code> file:</p> <p>Configure Surge in your <code>.lektorproject</code> file:</p>
<pre lang="ini"><span class="k">[servers.surge]</span><span class="w"></span> <pre lang="ini"><span class="k">[servers.surge]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">surge:my-domain.com</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">surge:my-domain.com</span>
</pre> </pre>
<p>To force all traffic to HTTPS, update your <code>.lektorproject</code> file:</p> <p>To force all traffic to HTTPS, update your <code>.lektorproject</code> file:</p>
<pre lang="ini"><span class="k">[servers.surge]</span><span class="w"></span> <pre lang="ini"><span class="k">[servers.surge]</span>
<span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">surge+https:my-domain.com</span><span class="w"></span> <span class="na">target</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">surge+https:my-domain.com</span>
</pre> </pre>
<p>For more information, see the <a href="https://surge.sh/help/using-https-by-default" rel="nofollow">Surge guide to HTTPS</a>.</p> <p>For more information, see the <a href="https://surge.sh/help/using-https-by-default" rel="nofollow">Surge guide to HTTPS</a>.</p>
<h2>Deployment</h2> <h2>Deployment</h2>

View File

@ -151,16 +151,16 @@ tea
<p>Each page can list all the posts with that tag.</p> <p>Each page can list all the posts with that tag.</p>
<h2>Installation</h2> <h2>Installation</h2>
<p>Add lektor-tags to your project from command line:</p> <p>Add lektor-tags to your project from command line:</p>
<pre lang="shell">lektor plugins add lektor-tags <pre lang="shell">lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-tags
</pre> </pre>
<p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p> <p>See <a href="https://www.getlektor.com/docs/plugins/" rel="nofollow">the Lektor documentation for more instructions on installing plugins</a>.</p>
<h2>Overview</h2> <h2>Overview</h2>
<p>Say you have a &quot;blog-post&quot; model like this:</p> <p>Say you have a &quot;blog-post&quot; model like this:</p>
<pre lang="ini"><span class="k">[model]</span><span class="w"></span> <pre lang="ini"><span class="k">[model]</span>
<span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog Post</span><span class="w"></span> <span class="na">name</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">Blog Post</span>
<span class="k">[fields.tags]</span><span class="w"></span> <span class="k">[fields.tags]</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">strings</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">strings</span>
</pre> </pre>
<p>Make a <code>blog-post.html</code> template that includes:</p> <p>Make a <code>blog-post.html</code> template that includes:</p>
<pre lang="html">{% if this.tags %} <pre lang="html">{% if this.tags %}
@ -189,33 +189,33 @@ tea
<p>Set these options in <code>configs/tags.ini</code>:</p> <p>Set these options in <code>configs/tags.ini</code>:</p>
<h3><code>parent</code></h3> <h3><code>parent</code></h3>
<p>Required. The source path of the tag pages' parent page. For example:</p> <p>Required. The source path of the tag pages' parent page. For example:</p>
<pre lang="ini"><span class="na">parent</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/blog</span><span class="w"></span> <pre lang="ini"><span class="na">parent</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/blog</span>
</pre> </pre>
<p>Then tag pages' source paths are like:</p> <p>Then tag pages' source paths are like:</p>
<pre><code>/blog/tag/my-tag <pre><code>/blog/tag/my-tag
</code></pre> </code></pre>
<p>You can specify the root as the parent:</p> <p>You can specify the root as the parent:</p>
<pre lang="ini"><span class="na">parent</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span><span class="w"></span> <pre lang="ini"><span class="na">parent</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">/</span>
</pre> </pre>
<h3><code>items</code></h3> <h3><code>items</code></h3>
<p>A query for all items on the page for one tag. You can use the variables <code>site</code> and <code>tag</code>. The template's <code>this</code> variable has a <code>parent</code> attribute. The default query is:</p> <p>A query for all items on the page for one tag. You can use the variables <code>site</code> and <code>tag</code>. The template's <code>this</code> variable has a <code>parent</code> attribute. The default query is:</p>
<pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.children.filter(F.tags.contains(tag))</span><span class="w"></span> <pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.children.filter(F.tags.contains(tag))</span>
</pre> </pre>
<p>You can sort and filter with any expression:</p> <p>You can sort and filter with any expression:</p>
<pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.children.filter(F.tags.contains(tag) and F.status == &#39;published&#39;).order_by(&#39;-pub_date&#39;)</span><span class="w"></span> <pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.children.filter(F.tags.contains(tag) and F.status == &#39;published&#39;).order_by(&#39;-pub_date&#39;)</span>
</pre> </pre>
<p>If the parent page has <a href="https://www.getlektor.com/docs/guides/pagination/" rel="nofollow">a pagination query</a> you may want to use it for tagged pages:</p> <p>If the parent page has <a href="https://www.getlektor.com/docs/guides/pagination/" rel="nofollow">a pagination query</a> you may want to use it for tagged pages:</p>
<pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.pagination.items.filter(F.tags.contains(tag))</span><span class="w"></span> <pre lang="ini"><span class="na">items</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">this.parent.pagination.items.filter(F.tags.contains(tag))</span>
</pre> </pre>
<p>See <a href="https://www.getlektor.com/docs/api/db/query/" rel="nofollow">the Lektor documentation for queries</a>.</p> <p>See <a href="https://www.getlektor.com/docs/api/db/query/" rel="nofollow">the Lektor documentation for queries</a>.</p>
<h3><code>tags_field</code></h3> <h3><code>tags_field</code></h3>
<p>The name of the field in your model that contains tags. Defaults to <code>tags</code>. The field should be of type <code>strings</code>. See <a href="https://www.getlektor.com/docs/api/db/types/strings/" rel="nofollow">the Lektor documentation for the <code>strings</code> type</a>.</p> <p>The name of the field in your model that contains tags. Defaults to <code>tags</code>. The field should be of type <code>strings</code>. See <a href="https://www.getlektor.com/docs/api/db/types/strings/" rel="nofollow">the Lektor documentation for the <code>strings</code> type</a>.</p>
<p>For example, if your model is like:</p> <p>For example, if your model is like:</p>
<pre lang="ini"><span class="k">[fields.labels]</span><span class="w"></span> <pre lang="ini"><span class="k">[fields.labels]</span>
<span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">strings</span><span class="w"></span> <span class="na">type</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">strings</span>
</pre> </pre>
<p>Then add this to <code>tags.ini</code>:</p> <p>Then add this to <code>tags.ini</code>:</p>
<pre lang="ini"><span class="na">tags_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">labels</span><span class="w"></span> <pre lang="ini"><span class="na">tags_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">labels</span>
</pre> </pre>
<h3><code>template</code></h3> <h3><code>template</code></h3>
<p>The template for the page that lists all posts with a certain tag. The template's <code>this</code> variable has attributes <code>tag</code> and <code>items</code>. An example template:</p> <p>The template for the page that lists all posts with a certain tag. The template's <code>this</code> variable has attributes <code>tag</code> and <code>items</code>. An example template:</p>
@ -230,17 +230,17 @@ tea
<span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span> <span class="p">&lt;/</span><span class="nt">ul</span><span class="p">&gt;</span>
</pre> </pre>
<p>Save a file like this to your project's <code>templates/tags.html</code>. If you name the file something different, like <code>label.html</code>, add this line to <code>tags.ini</code>:</p> <p>Save a file like this to your project's <code>templates/tags.html</code>. If you name the file something different, like <code>label.html</code>, add this line to <code>tags.ini</code>:</p>
<pre lang="ini"><span class="na">template</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">label.html</span><span class="w"></span> <pre lang="ini"><span class="na">template</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">label.html</span>
</pre> </pre>
<p>The plugin provides a default template if you don't specify one.</p> <p>The plugin provides a default template if you don't specify one.</p>
<h3><code>url_path</code></h3> <h3><code>url_path</code></h3>
<p>An expression for the location of each tag page. You can use the variables <code>site</code> and <code>tag</code>. The <code>this</code> variable is a page with attributes <code>parent</code> and <code>items</code>. The default expression is:</p> <p>An expression for the location of each tag page. You can use the variables <code>site</code> and <code>tag</code>. The <code>this</code> variable is a page with attributes <code>parent</code> and <code>items</code>. The default expression is:</p>
<pre lang="ini"><span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.parent.url_path }}tag/{{ tag }}</span><span class="w"></span> <pre lang="ini"><span class="na">url_path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">{{ this.parent.url_path }}tag/{{ tag }}</span>
</pre> </pre>
<p>This expression generates URLs like <code>/blog/tag/coffee</code>.</p> <p>This expression generates URLs like <code>/blog/tag/coffee</code>.</p>
<h3><code>ignore_missing</code></h3> <h3><code>ignore_missing</code></h3>
<p>Default false. To set true, add this line to <code>tags.ini</code>:</p> <p>Default false. To set true, add this line to <code>tags.ini</code>:</p>
<pre lang="ini"><span class="na">ignore_missing</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span><span class="w"></span> <pre lang="ini"><span class="na">ignore_missing</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">true</span>
</pre> </pre>
<p>This allows URLs to missing tag pages to be silently replaced with &quot;&quot;. The example use case is if your <code>blog-post.html</code> template includes a statement like:</p> <p>This allows URLs to missing tag pages to be silently replaced with &quot;&quot;. The example use case is if your <code>blog-post.html</code> template includes a statement like:</p>
<pre lang="html">{% for t in this.tags -%} <pre lang="html">{% for t in this.tags -%}
@ -250,19 +250,19 @@ tea
<p>If a blog post <em>draft</em> is not discoverable, and it has any new tags used by no published blog posts, then those tag pages do not yet exist. Turn on <code>ignore_missing</code> to allow such drafts to be built. The tag-page URL path will be the empty string &quot;&quot;, until the draft is published and the tag page is created.</p> <p>If a blog post <em>draft</em> is not discoverable, and it has any new tags used by no published blog posts, then those tag pages do not yet exist. Turn on <code>ignore_missing</code> to allow such drafts to be built. The tag-page URL path will be the empty string &quot;&quot;, until the draft is published and the tag page is created.</p>
<h3><code>tags</code></h3> <h3><code>tags</code></h3>
<p>Advanced configuration. An expression for the set of tags. Note that this expression is also useful in a template to get a list of all tags. The default expression is:</p> <p>Advanced configuration. An expression for the set of tags. Note that this expression is also useful in a template to get a list of all tags. The default expression is:</p>
<pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.distinct(&quot;tags&quot;)</span><span class="w"></span> <pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.distinct(&quot;tags&quot;)</span>
</pre> </pre>
<p>If you set <code>tags_field</code> to a different field name than &quot;tags&quot;, the default expression uses your custom field name. For example if you have this line in <code>tags.ini</code>:</p> <p>If you set <code>tags_field</code> to a different field name than &quot;tags&quot;, the default expression uses your custom field name. For example if you have this line in <code>tags.ini</code>:</p>
<pre lang="ini"><span class="na">tags_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">labels</span><span class="w"></span> <pre lang="ini"><span class="na">tags_field</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">labels</span>
</pre> </pre>
<p>Then the default value of <code>tags</code> is:</p> <p>Then the default value of <code>tags</code> is:</p>
<pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.distinct(&quot;labels&quot;)</span><span class="w"></span> <pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.distinct(&quot;labels&quot;)</span>
</pre> </pre>
<p>You can use any template expression. For example, if your items have a &quot;published&quot; boolean field, you can select tags of published items:</p> <p>You can use any template expression. For example, if your items have a &quot;published&quot; boolean field, you can select tags of published items:</p>
<pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.filter(F.published).distinct(&quot;tags&quot;)</span><span class="w"></span> <pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">parent.children.filter(F.published).distinct(&quot;tags&quot;)</span>
</pre> </pre>
<p>Or even list your tags manually:</p> <p>Or even list your tags manually:</p>
<pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">[&quot;tag1&quot;, &quot;tag2&quot;]</span><span class="w"></span> <pre lang="ini"><span class="na">tags</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">[&quot;tag1&quot;, &quot;tag2&quot;]</span>
</pre> </pre>
<p>See <a href="https://www.getlektor.com/docs/api/db/query/" rel="nofollow">the Lektor documentation for queries</a>.</p> <p>See <a href="https://www.getlektor.com/docs/api/db/query/" rel="nofollow">the Lektor documentation for queries</a>.</p>
<p>Tags are always deduplicated. Tags are sorted in the order listed in the contents.lr / admin, allowing you to control their order manually. Since <code>{{ tags }}</code> simply returns a list, you can always apply any Jinja2 filter on that list such as sort, slice, or rejectattr.</p> <p>Tags are always deduplicated. Tags are sorted in the order listed in the contents.lr / admin, allowing you to control their order manually. Since <code>{{ tags }}</code> simply returns a list, you can always apply any Jinja2 filter on that list such as sort, slice, or rejectattr.</p>
@ -280,9 +280,9 @@ tea
<p>This is the basic weight, used as a base for the following tags.</p> <p>This is the basic weight, used as a base for the following tags.</p>
<h4>Example: Tags (with tag count) sorted by tag count (most used first)</h4> <h4>Example: Tags (with tag count) sorted by tag count (most used first)</h4>
<pre lang="jinja"><span class="x">&lt;ul&gt;</span> <pre lang="jinja"><span class="x">&lt;ul&gt;</span>
<span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="o">(</span><span class="nv">tagweights</span><span class="o">()</span> <span class="o">|</span> <span class="nf">dictsort</span><span class="o">(</span><span class="nv">by</span><span class="o">=</span><span class="s1">&#39;value&#39;</span><span class="o">,</span> <span class="nv">reverse</span><span class="o">=</span><span class="kp">true</span><span class="o">))</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="o">(</span><span class="nv">tagweights</span><span class="o">()</span> <span class="o">|</span> <span class="nf">dictsort</span><span class="o">(</span><span class="nv">by</span><span class="o">=</span><span class="s1">&#39;value&#39;</span><span class="o">,</span> <span class="nv">reverse</span><span class="o">=</span><span class="kp">true</span><span class="o">))</span> <span class="cp">%}</span>
<span class="x"> &lt;li&gt;</span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span><span class="x"> (</span><span class="cp">{{</span> <span class="nv">weight.count</span> <span class="cp">}}</span><span class="x"> articles).&lt;/li&gt;</span> <span class="x"> &lt;li&gt;</span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span><span class="x"> (</span><span class="cp">{{</span> <span class="nv">weight.count</span> <span class="cp">}}</span><span class="x"> articles).&lt;/li&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
<span class="x">&lt;/ul&gt;</span> <span class="x">&lt;/ul&gt;</span>
</pre> </pre>
<h3><code>linear</code> — Tags are mapped with a number between <code>lower</code> and <code>upper</code>.</h3> <h3><code>linear</code> — Tags are mapped with a number between <code>lower</code> and <code>upper</code>.</h3>
@ -295,14 +295,14 @@ tea
<p>Mapping is done using a linear function over the logarithm of tag counts.</p> <p>Mapping is done using a linear function over the logarithm of tag counts.</p>
<p>The result is a float: you might want to convert them to integers first (see example).</p> <p>The result is a float: you might want to convert them to integers first (see example).</p>
<h4>Example: Most used tag is twice as big as least used tag</h4> <h4>Example: Most used tag is twice as big as least used tag</h4>
<pre lang="jinja"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="nv">tagweights</span><span class="o">()|</span><span class="nf">dictsort</span> <span class="cp">%}</span><span class="x"></span> <pre lang="jinja"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="nv">tagweights</span><span class="o">()|</span><span class="nf">dictsort</span> <span class="cp">%}</span>
<span class="x">&lt;a</span> <span class="x">&lt;a</span>
<span class="x"> href=&quot;</span><span class="cp">{{</span> <span class="o">(</span><span class="s1">&#39;/blog@tag/&#39;</span> <span class="o">~</span> <span class="nv">tag</span><span class="o">)|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&quot;</span> <span class="x"> href=&quot;</span><span class="cp">{{</span> <span class="o">(</span><span class="s1">&#39;/blog@tag/&#39;</span> <span class="o">~</span> <span class="nv">tag</span><span class="o">)|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&quot;</span>
<span class="x"> style=&quot;font-size: </span><span class="cp">{{</span> <span class="nv">weight.log</span><span class="o">(</span><span class="m">100</span><span class="o">,</span> <span class="m">200</span><span class="o">)|</span><span class="nf">round</span><span class="o">|</span><span class="nf">int</span> <span class="cp">}}</span><span class="x">%;&quot;</span> <span class="x"> style=&quot;font-size: </span><span class="cp">{{</span> <span class="nv">weight.log</span><span class="o">(</span><span class="m">100</span><span class="o">,</span> <span class="m">200</span><span class="o">)|</span><span class="nf">round</span><span class="o">|</span><span class="nf">int</span> <span class="cp">}}</span><span class="x">%;&quot;</span>
<span class="x"> &gt;</span> <span class="x"> &gt;</span>
<span class="x"> </span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span><span class="x"></span> <span class="x"> </span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span>
<span class="x"> &lt;/a&gt;</span> <span class="x"> &lt;/a&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre> </pre>
<h3><code>lineargroup</code> — Map each tag with an item of the list given in argument</h3> <h3><code>lineargroup</code> — Map each tag with an item of the list given in argument</h3>
<p>The less used tag is mapped with the first item, the most used tag is mapped with the last item.</p> <p>The less used tag is mapped with the first item, the most used tag is mapped with the last item.</p>
@ -312,14 +312,14 @@ tea
<p>The less used tag is mapped with the first item, the most used tag is mapped with the last item.</p> <p>The less used tag is mapped with the first item, the most used tag is mapped with the last item.</p>
<p>Mapping is done using a linear function over the logarithm of tag counts.</p> <p>Mapping is done using a linear function over the logarithm of tag counts.</p>
<h4>Example: Tags are given CSS classes <code>tagcloud-tiny</code>, <code>tagcloud-small</code>, etc.</h4> <h4>Example: Tags are given CSS classes <code>tagcloud-tiny</code>, <code>tagcloud-small</code>, etc.</h4>
<pre lang="jinja"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="nv">tagweights</span><span class="o">()|</span><span class="nf">dictsort</span> <span class="cp">%}</span><span class="x"></span> <pre lang="jinja"><span class="cp">{%</span> <span class="k">for</span> <span class="nv">tag</span><span class="o">,</span> <span class="nv">weight</span> <span class="k">in</span> <span class="nv">tagweights</span><span class="o">()|</span><span class="nf">dictsort</span> <span class="cp">%}</span>
<span class="x">&lt;a</span> <span class="x">&lt;a</span>
<span class="x"> href=&quot;</span><span class="cp">{{</span> <span class="o">(</span><span class="s1">&#39;/blog@tag/&#39;</span> <span class="o">~</span> <span class="nv">tag</span><span class="o">)|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&quot;</span> <span class="x"> href=&quot;</span><span class="cp">{{</span> <span class="o">(</span><span class="s1">&#39;/blog@tag/&#39;</span> <span class="o">~</span> <span class="nv">tag</span><span class="o">)|</span><span class="nf">url</span> <span class="cp">}}</span><span class="x">&quot;</span>
<span class="x"> class=&quot;tagcloud-</span><span class="cp">{{</span> <span class="nv">weight.loggroup</span><span class="o">([</span><span class="s2">&quot;tiny&quot;</span><span class="o">,</span> <span class="s2">&quot;small&quot;</span><span class="o">,</span> <span class="s2">&quot;normal&quot;</span><span class="o">,</span> <span class="s2">&quot;big&quot;</span><span class="o">,</span> <span class="s2">&quot;large&quot;</span><span class="o">])</span> <span class="cp">}}</span><span class="x">&quot;</span> <span class="x"> class=&quot;tagcloud-</span><span class="cp">{{</span> <span class="nv">weight.loggroup</span><span class="o">([</span><span class="s2">&quot;tiny&quot;</span><span class="o">,</span> <span class="s2">&quot;small&quot;</span><span class="o">,</span> <span class="s2">&quot;normal&quot;</span><span class="o">,</span> <span class="s2">&quot;big&quot;</span><span class="o">,</span> <span class="s2">&quot;large&quot;</span><span class="o">])</span> <span class="cp">}}</span><span class="x">&quot;</span>
<span class="x"> &gt;</span> <span class="x"> &gt;</span>
<span class="x"> </span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span><span class="x"></span> <span class="x"> </span><span class="cp">{{</span> <span class="nv">tag</span> <span class="cp">}}</span>
<span class="x"> &lt;/a&gt;</span> <span class="x"> &lt;/a&gt;</span>
<span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span><span class="x"></span> <span class="cp">{%</span> <span class="k">endfor</span> <span class="cp">%}</span>
</pre> </pre>

View File

@ -136,34 +136,34 @@
<ol> <ol>
<li> <li>
<p>Add plugin to your project</p> <p>Add plugin to your project</p>
<pre lang="bash">$ lektor plugin add lektor-tailwind <pre lang="bash">$<span class="w"> </span>lektor<span class="w"> </span>plugin<span class="w"> </span>add<span class="w"> </span>lektor-tailwind
$ lektor plugin list $<span class="w"> </span>lektor<span class="w"> </span>plugin<span class="w"> </span>list
</pre> </pre>
</li> </li>
<li> <li>
<p>Configure your template paths</p> <p>Configure your template paths</p>
<p>In <code>tailwindcss.config.js</code>:</p> <p>In <code>tailwindcss.config.js</code>:</p>
<pre lang="javascript"><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <pre lang="javascript"><span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">content</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s1">&#39;./templates/**/*.{html,j2}&#39;</span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="nx">content</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s1">&#39;./templates/**/*.{html,j2}&#39;</span><span class="p">],</span>
<span class="w"> </span><span class="nx">theme</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">theme</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">extend</span><span class="o">:</span><span class="w"> </span><span class="p">{},</span><span class="w"></span> <span class="w"> </span><span class="nx">extend</span><span class="o">:</span><span class="w"> </span><span class="p">{},</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[],</span><span class="w"></span> <span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[],</span>
<span class="p">}</span><span class="w"></span> <span class="p">}</span>
</pre> </pre>
</li> </li>
<li> <li>
<p>Add the Tailwind directives to your CSS</p> <p>Add the Tailwind directives to your CSS</p>
<p>In <code>assets/static/style.css</code>:</p> <p>In <code>assets/static/style.css</code>:</p>
<pre lang="css"><span class="p">@</span><span class="k">tailwind</span><span class="w"> </span><span class="nt">base</span><span class="p">;</span><span class="w"></span> <pre lang="css"><span class="p">@</span><span class="k">tailwind</span><span class="w"> </span><span class="nt">base</span><span class="p">;</span>
<span class="p">@</span><span class="k">tailwind</span><span class="w"> </span><span class="nt">components</span><span class="p">;</span><span class="w"></span> <span class="p">@</span><span class="k">tailwind</span><span class="w"> </span><span class="nt">components</span><span class="p">;</span>
<span class="p">@</span><span class="k">tailwind</span><span class="w"> </span><span class="nt">utilities</span><span class="p">;</span><span class="w"></span> <span class="p">@</span><span class="k">tailwind</span><span class="w"> </span><span class="nt">utilities</span><span class="p">;</span>
</pre> </pre>
</li> </li>
<li> <li>
<p>Start lektor build or server:</p> <p>Start lektor build or server:</p>
<pre lang="bash">$ lektor build <pre lang="bash">$<span class="w"> </span>lektor<span class="w"> </span>build
$ lektor server $<span class="w"> </span>lektor<span class="w"> </span>server
</pre> </pre>
</li> </li>
</ol> </ol>

View File

@ -138,47 +138,47 @@
These files will then be copied over to Lektors templates folder so that they can be used by Lektor. These files will then be copied over to Lektors templates folder so that they can be used by Lektor.
This plugin depends on the <a href="https://github.com/lektor/lektor-webpack-support" rel="nofollow">lektor-webpack-support</a> plugin to be really useful.</p> This plugin depends on the <a href="https://github.com/lektor/lektor-webpack-support" rel="nofollow">lektor-webpack-support</a> plugin to be really useful.</p>
<h1>webpack/webpack.config.js</h1> <h1>webpack/webpack.config.js</h1>
<pre lang="js"><span class="kd">const</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;path&quot;</span><span class="p">);</span><span class="w"></span> <pre lang="js"><span class="kd">const</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;path&quot;</span><span class="p">);</span>
<span class="kd">const</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;mini-css-extract-plugin&quot;</span><span class="p">);</span><span class="w"></span> <span class="kd">const</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;mini-css-extract-plugin&quot;</span><span class="p">);</span>
<span class="kd">const</span><span class="w"> </span><span class="nx">HtmlWebpackPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;html-webpack-plugin&quot;</span><span class="p">);</span><span class="w"></span> <span class="kd">const</span><span class="w"> </span><span class="nx">HtmlWebpackPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;html-webpack-plugin&quot;</span><span class="p">);</span>
<span class="kd">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">CleanWebpackPlugin</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;clean-webpack-plugin&quot;</span><span class="p">);</span><span class="w"></span> <span class="kd">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nx">CleanWebpackPlugin</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;clean-webpack-plugin&quot;</span><span class="p">);</span>
<span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">mode</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;production&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">mode</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;production&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">main</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./src/index.js&quot;</span><span class="w"></span> <span class="w"> </span><span class="nx">main</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./src/index.js&quot;</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].bundle.js&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].bundle.js&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="s2">&quot;/assets/generated&quot;</span><span class="w"> </span> <span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">)</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="s2">&quot;/assets/generated&quot;</span><span class="w"> </span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">optimization</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">optimization</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">minimizer</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w"></span> <span class="w"> </span><span class="nx">minimizer</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">HtmlWebpackPlugin</span><span class="p">({</span><span class="w"></span> <span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">HtmlWebpackPlugin</span><span class="p">({</span>
<span class="w"> </span><span class="nx">inject</span><span class="o">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">inject</span><span class="o">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;layout_generated.html&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;layout_generated.html&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">template</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./src/layout_template.html&quot;</span><span class="w"></span> <span class="w"> </span><span class="nx">template</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./src/layout_template.html&quot;</span>
<span class="w"> </span><span class="p">})</span><span class="w"></span> <span class="w"> </span><span class="p">})</span>
<span class="w"> </span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w"></span> <span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">CleanWebpackPlugin</span><span class="p">(),</span><span class="w"></span> <span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">CleanWebpackPlugin</span><span class="p">(),</span>
<span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">({</span><span class="w"></span> <span class="w"> </span><span class="ow">new</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">({</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].css&quot;</span><span class="w"></span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].css&quot;</span>
<span class="w"> </span><span class="p">})</span><span class="w"></span> <span class="w"> </span><span class="p">})</span>
<span class="w"> </span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="p">],</span>
<span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">rules</span><span class="o">:</span><span class="w"> </span><span class="p">[{</span><span class="w"></span> <span class="w"> </span><span class="nx">rules</span><span class="o">:</span><span class="w"> </span><span class="p">[{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w"></span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span>
<span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="s2">&quot;sass-loader&quot;</span><span class="w"></span> <span class="w"> </span><span class="s2">&quot;sass-loader&quot;</span>
<span class="w"> </span><span class="p">]</span><span class="w"></span> <span class="w"> </span><span class="p">]</span>
<span class="w"> </span><span class="p">}]</span><span class="w"></span> <span class="w"> </span><span class="p">}]</span>
<span class="w"> </span><span class="p">}</span><span class="w"></span> <span class="w"> </span><span class="p">}</span>
<span class="p">}</span><span class="w"></span> <span class="p">}</span>
</pre> </pre>
<h1>webpack/src/layout_template.html</h1> <h1>webpack/src/layout_template.html</h1>
<pre lang="html"><span class="cp">&lt;!DOCTYPE html&gt;</span> <pre lang="html"><span class="cp">&lt;!DOCTYPE html&gt;</span>

View File

@ -153,7 +153,7 @@ the <code>-f webpack</code> flag.</p>
<h2>Enabling the Plugin</h2> <h2>Enabling the Plugin</h2>
<p>To enable the plugin add this to your project file, run this command while <p>To enable the plugin add this to your project file, run this command while
sitting in your Lektor project directory:</p> sitting in your Lektor project directory:</p>
<pre lang="bash">lektor plugins add lektor-webpack-support <pre lang="bash">lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-webpack-support
</pre> </pre>
<h2>Creating a Webpack Project</h2> <h2>Creating a Webpack Project</h2>
<p>Next you need to create a webpack project. Create a <code>webpack/</code> folder and <p>Next you need to create a webpack project. Create a <code>webpack/</code> folder and
@ -162,11 +162,11 @@ inside that folder create <code>package.json</code> and a <code>webpack.config.j
<p>This file instructs <code>npm</code> which packages we will need. All we need for a <p>This file instructs <code>npm</code> which packages we will need. All we need for a
start is to create an almost empty file (name and version fields are mandatory start is to create an almost empty file (name and version fields are mandatory
but not important for functionality, change them to suit your own needs):</p> but not important for functionality, change them to suit your own needs):</p>
<pre lang="json"><span class="p">{</span><span class="w"></span> <pre lang="json"><span class="p">{</span>
<span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;lektor-webpack&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;lektor-webpack&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;1.0.0&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;version&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;1.0.0&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nt">&quot;private&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w"></span> <span class="w"> </span><span class="nt">&quot;private&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span>
<span class="p">}</span><span class="w"></span> <span class="p">}</span>
</pre> </pre>
<p>Now we can <code>npm install</code> (or <code>yarn add</code>) the rest:</p> <p>Now we can <code>npm install</code> (or <code>yarn add</code>) the rest:</p>
<pre><code>$ cd &lt;/path/to/your/lektor/project&gt;/webpack <pre><code>$ cd &lt;/path/to/your/lektor/project&gt;/webpack
@ -182,43 +182,43 @@ setup that's good enough to cover most things you will encounter. The
idea is to build the files from <code>webpack/scss</code> and <code>webpack/js</code> into idea is to build the files from <code>webpack/scss</code> and <code>webpack/js</code> into
<code>assets/static/gen</code> so that we can use it even if we do not have webpack <code>assets/static/gen</code> so that we can use it even if we do not have webpack
installed for as long as someone else ran it before.</p> installed for as long as someone else ran it before.</p>
<pre lang="javascript"><span class="kd">const</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;path&quot;</span><span class="p">);</span><span class="w"></span> <pre lang="javascript"><span class="kd">const</span><span class="w"> </span><span class="nx">path</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;path&quot;</span><span class="p">);</span>
<span class="kd">const</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;mini-css-extract-plugin&quot;</span><span class="p">);</span><span class="w"></span> <span class="kd">const</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nx">require</span><span class="p">(</span><span class="s2">&quot;mini-css-extract-plugin&quot;</span><span class="p">);</span>
<span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="nx">module</span><span class="p">.</span><span class="nx">exports</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">entry</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">app</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./js/main.js&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">app</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./js/main.js&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">styles</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./scss/main.scss&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">styles</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;./scss/main.scss&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">output</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">),</span><span class="w"> </span><span class="s2">&quot;assets&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;static&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;gen&quot;</span><span class="p">),</span><span class="w"></span> <span class="w"> </span><span class="nx">path</span><span class="o">:</span><span class="w"> </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span><span class="p">(</span><span class="nx">__dirname</span><span class="p">),</span><span class="w"> </span><span class="s2">&quot;assets&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;static&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;gen&quot;</span><span class="p">),</span>
<span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].js&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;[name].js&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">devtool</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;source-map&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">devtool</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;source-map&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">mode</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;production&quot;</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">mode</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;production&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="nx">module</span><span class="o">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">rules</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="w"></span> <span class="w"> </span><span class="nx">rules</span><span class="o">:</span><span class="w"> </span><span class="p">[</span>
<span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.js$/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.js$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">exclude</span><span class="o">:</span><span class="w"> </span><span class="sr">/node_modules/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">exclude</span><span class="o">:</span><span class="w"> </span><span class="sr">/node_modules/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;babel-loader&quot;</span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;babel-loader&quot;</span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.scss$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;sass-loader&quot;</span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;sass-loader&quot;</span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.css$/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.css$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="nx">MiniCssExtractPlugin</span><span class="p">.</span><span class="nx">loader</span><span class="p">,</span><span class="w"> </span><span class="s2">&quot;css-loader&quot;</span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">{</span><span class="w"></span> <span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/</span><span class="p">,</span><span class="w"></span> <span class="w"> </span><span class="nx">test</span><span class="o">:</span><span class="w"> </span><span class="sr">/\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/</span><span class="p">,</span>
<span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;file&quot;</span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="nx">use</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="s2">&quot;file&quot;</span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="p">],</span><span class="w"></span> <span class="w"> </span><span class="p">],</span>
<span class="w"> </span><span class="p">},</span><span class="w"></span> <span class="w"> </span><span class="p">},</span>
<span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="ow">new</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">({</span><span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;styles.css&quot;</span><span class="w"> </span><span class="p">})],</span><span class="w"></span> <span class="w"> </span><span class="nx">plugins</span><span class="o">:</span><span class="w"> </span><span class="p">[</span><span class="ow">new</span><span class="w"> </span><span class="nx">MiniCssExtractPlugin</span><span class="p">({</span><span class="w"> </span><span class="nx">filename</span><span class="o">:</span><span class="w"> </span><span class="s2">&quot;styles.css&quot;</span><span class="w"> </span><span class="p">})],</span>
<span class="p">};</span><span class="w"></span> <span class="p">};</span>
</pre> </pre>
<h2>Creating the App</h2> <h2>Creating the App</h2>
<p>Now we can start building our app. We configured at least two files <p>Now we can start building our app. We configured at least two files

View File

@ -134,7 +134,7 @@
to <a href="https://www.getlektor.com" rel="nofollow">Lektor CMS</a></p> to <a href="https://www.getlektor.com" rel="nofollow">Lektor CMS</a></p>
<section id="enabling-the-plugin"> <section id="enabling-the-plugin">
<h2>Enabling the Plugin</h2> <h2>Enabling the Plugin</h2>
<pre><code>lektor plugins add lektor-yandex-metrica</code></pre> <pre><code>lektor<span class="w"> </span>plugins<span class="w"> </span>add<span class="w"> </span>lektor-yandex-metrica</code></pre>
</section> </section>
<section id="configuring-the-plugin"> <section id="configuring-the-plugin">
<h2>Configuring the Plugin</h2> <h2>Configuring the Plugin</h2>