Merge branch 'master' into master
|
@ -1,5 +1,5 @@
|
|||
language: python
|
||||
python: 2.7
|
||||
python: 3.5
|
||||
install:
|
||||
- "pip install -U pip"
|
||||
- "pip install git+https://github.com/lektor/lektor#egg=Lektor"
|
||||
|
|
|
@ -10,7 +10,7 @@ target = rsync://deploy@flow.srv.pocoo.org/srv/websites/getlektor.com/static
|
|||
default = yes
|
||||
|
||||
[packages]
|
||||
lektor-webpack-support = 0.1
|
||||
lektor-webpack-support = 0.3
|
||||
lektor-disqus-comments = 0.1
|
||||
lektor-markdown-header-anchors = 0.1
|
||||
lektor-markdown-highlighter = 0.1
|
||||
|
|
|
@ -2,13 +2,19 @@ $InstallScript = @"
|
|||
import os
|
||||
import sys
|
||||
import json
|
||||
import urllib
|
||||
import tempfile
|
||||
import tarfile
|
||||
import shutil
|
||||
from subprocess import Popen
|
||||
from _winreg import OpenKey, CloseKey, QueryValueEx, SetValueEx, \
|
||||
try: # py3
|
||||
from urllib.request import urlopen
|
||||
from winreg import OpenKey, CloseKey, QueryValueEx, SetValueEx, \
|
||||
HKEY_CURRENT_USER, KEY_ALL_ACCESS, REG_EXPAND_SZ
|
||||
except ImportError: # py2
|
||||
from urllib import urlopen
|
||||
from _winreg import OpenKey, CloseKey, QueryValueEx, SetValueEx, \
|
||||
HKEY_CURRENT_USER, KEY_ALL_ACCESS, REG_EXPAND_SZ
|
||||
|
||||
import ctypes
|
||||
from ctypes.wintypes import HWND, UINT, WPARAM, LPARAM, LPVOID
|
||||
|
||||
|
@ -23,15 +29,19 @@ LRESULT = LPARAM
|
|||
HWND_BROADCAST = 0xFFFF
|
||||
WM_SETTINGCHANGE = 0x1A
|
||||
|
||||
PY2 = sys.version_info[0] == 2
|
||||
if PY2:
|
||||
input = raw_input
|
||||
|
||||
|
||||
def get_confirmation():
|
||||
while 1:
|
||||
input = raw_input('Continue? [Yn] ').lower().strip()
|
||||
if input in ('', 'y'):
|
||||
user_input = input('Continue? [Yn] ').lower().strip()
|
||||
if user_input in ('', 'y'):
|
||||
break
|
||||
elif input == 'n':
|
||||
print
|
||||
print 'Aborted!'
|
||||
elif user_input == 'n':
|
||||
print()
|
||||
print('Aborted!')
|
||||
sys.exit()
|
||||
|
||||
def find_location():
|
||||
|
@ -39,9 +49,9 @@ def find_location():
|
|||
return install_dir, os.path.join(install_dir, LIB)
|
||||
|
||||
def deletion_error(func, path, excinfo):
|
||||
print 'Problem deleting {}'.format(path)
|
||||
print 'Please try and delete {} manually'.format(path)
|
||||
print 'Aborted!'
|
||||
print('Problem deleting {}'.format(path))
|
||||
print('Please try and delete {} manually'.format(path))
|
||||
print('Aborted!')
|
||||
sys.exit()
|
||||
|
||||
def wipe_installation(install_dir):
|
||||
|
@ -49,16 +59,16 @@ def wipe_installation(install_dir):
|
|||
|
||||
def check_installation(install_dir):
|
||||
if os.path.exists(install_dir):
|
||||
print ' Lektor seems to be installed already.'
|
||||
print ' Continuing will delete:'
|
||||
print ' %s' % install_dir
|
||||
print
|
||||
print(' Lektor seems to be installed already.')
|
||||
print(' Continuing will delete:')
|
||||
print(' %s' % install_dir)
|
||||
print()
|
||||
get_confirmation()
|
||||
print
|
||||
print()
|
||||
wipe_installation(install_dir)
|
||||
|
||||
def fail(message):
|
||||
print 'Error: %s' % message
|
||||
print('Error: %s' % message)
|
||||
sys.exit(1)
|
||||
|
||||
def add_to_path(location):
|
||||
|
@ -83,7 +93,7 @@ def add_to_path(location):
|
|||
def install(virtualenv_url, virtualenv_filename, install_dir, lib_dir):
|
||||
t = tempfile.mkdtemp()
|
||||
with open(os.path.join(t, 'virtualenv.tar.gz'), 'wb') as f:
|
||||
download = urllib.urlopen(virtualenv_url)
|
||||
download = urlopen(virtualenv_url)
|
||||
f.write(download.read())
|
||||
download.close()
|
||||
with tarfile.open(os.path.join(t, 'virtualenv.tar.gz'), 'r:gz') as tar:
|
||||
|
@ -108,22 +118,22 @@ def install(virtualenv_url, virtualenv_filename, install_dir, lib_dir):
|
|||
|
||||
|
||||
def main():
|
||||
print
|
||||
print 'Welcome to Lektor'
|
||||
print
|
||||
print 'This script will install Lektor on your computer.'
|
||||
print
|
||||
print()
|
||||
print('Welcome to Lektor')
|
||||
print()
|
||||
print('This script will install Lektor on your computer.')
|
||||
print()
|
||||
|
||||
install_dir, lib_dir = find_location()
|
||||
|
||||
check_installation(install_dir)
|
||||
|
||||
print ' Installing at:'
|
||||
print ' %s' % install_dir
|
||||
print
|
||||
print(' Installing at:')
|
||||
print(' %s' % install_dir)
|
||||
print()
|
||||
get_confirmation()
|
||||
|
||||
for url in json.load(urllib.urlopen(VENV_URL))['urls']:
|
||||
for url in json.load(urlopen(VENV_URL))['urls']:
|
||||
if url['python_version'] == 'source':
|
||||
virtualenv_url = url['url']
|
||||
#stripping '.tar.gz'
|
||||
|
@ -134,8 +144,8 @@ def main():
|
|||
|
||||
install(virtualenv_url, virtualenv_filename, install_dir, lib_dir)
|
||||
|
||||
print
|
||||
print 'All done!'
|
||||
print()
|
||||
print('All done!')
|
||||
|
||||
main()
|
||||
"@
|
||||
|
|
|
@ -11,25 +11,28 @@
|
|||
I() {
|
||||
set -u
|
||||
|
||||
if hash python2 2> /dev/null; then
|
||||
PY=python2
|
||||
elif hash python 2> /dev/null; then
|
||||
PY=python
|
||||
else
|
||||
if ! hash python 2> /dev/null; then
|
||||
echo "Error: To use this script you need to have Python installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$PY - <<'EOF'
|
||||
python - <<'EOF'
|
||||
if 1:
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import urllib
|
||||
import tempfile
|
||||
import shutil
|
||||
from subprocess import Popen
|
||||
try:
|
||||
from urllib.request import urlopen
|
||||
except ImportError:
|
||||
from urllib import urlopen
|
||||
|
||||
PY2 = sys.version_info[0] == 2
|
||||
if PY2:
|
||||
input = raw_input
|
||||
|
||||
sys.stdin = open('/dev/tty', 'r')
|
||||
|
||||
|
@ -71,18 +74,18 @@ if 1:
|
|||
|
||||
def get_confirmation():
|
||||
while 1:
|
||||
input = raw_input('Continue? [Yn] ').lower().strip()
|
||||
if input in ('', 'y'):
|
||||
user_input = input('Continue? [Yn] ').lower().strip()
|
||||
if user_input in ('', 'y'):
|
||||
break
|
||||
elif input == 'n':
|
||||
print
|
||||
print 'Aborted!'
|
||||
elif user_input == 'n':
|
||||
print()
|
||||
print('Aborted!')
|
||||
sys.exit()
|
||||
|
||||
def deletion_error(func, path, excinfo):
|
||||
print 'Problem deleting {}'.format(path)
|
||||
print 'Please try and delete {} manually'.format(path)
|
||||
print 'Aborted!'
|
||||
print('Problem deleting {}'.format(path))
|
||||
print('Please try and delete {} manually'.format(path))
|
||||
print('Aborted!')
|
||||
sys.exit()
|
||||
|
||||
def wipe_installation(lib_dir, symlink_path):
|
||||
|
@ -94,18 +97,18 @@ if 1:
|
|||
def check_installation(lib_dir, bin_dir):
|
||||
symlink_path = os.path.join(bin_dir, 'lektor')
|
||||
if os.path.exists(lib_dir) or os.path.lexists(symlink_path):
|
||||
print ' Lektor seems to be installed already.'
|
||||
print ' Continuing will delete:'
|
||||
print ' %s' % lib_dir
|
||||
print ' and remove this symlink:'
|
||||
print ' %s' % symlink_path
|
||||
print
|
||||
print(' Lektor seems to be installed already.')
|
||||
print(' Continuing will delete:')
|
||||
print(' %s' % lib_dir)
|
||||
print(' and remove this symlink:')
|
||||
print(' %s' % symlink_path)
|
||||
print()
|
||||
if prompt: get_confirmation()
|
||||
print
|
||||
print()
|
||||
wipe_installation(lib_dir, symlink_path)
|
||||
|
||||
def fail(message):
|
||||
print 'Error: %s' % message
|
||||
print('Error: %s' % message)
|
||||
sys.exit(1)
|
||||
|
||||
def install(virtualenv_url, lib_dir, bin_dir):
|
||||
|
@ -124,11 +127,11 @@ if 1:
|
|||
os.path.join(bin_dir, 'lektor'))
|
||||
|
||||
def main():
|
||||
print
|
||||
print 'Welcome to Lektor'
|
||||
print
|
||||
print 'This script will install Lektor on your computer.'
|
||||
print
|
||||
print()
|
||||
print('Welcome to Lektor')
|
||||
print()
|
||||
print('This script will install Lektor on your computer.')
|
||||
print()
|
||||
|
||||
paths = find_user_paths()
|
||||
if not paths:
|
||||
|
@ -141,14 +144,14 @@ if 1:
|
|||
|
||||
check_installation(lib_dir, bin_dir)
|
||||
|
||||
print 'Installing at:'
|
||||
print ' bin: %s' % bin_dir
|
||||
print ' app: %s' % lib_dir
|
||||
print
|
||||
print('Installing at:')
|
||||
print(' bin: %s' % bin_dir)
|
||||
print(' app: %s' % lib_dir)
|
||||
print()
|
||||
|
||||
if prompt: get_confirmation()
|
||||
|
||||
for url in json.load(urllib.urlopen(VENV_URL))['urls']:
|
||||
for url in json.loads(urlopen(VENV_URL).read().decode('utf-8'))['urls']:
|
||||
if url['python_version'] == 'source':
|
||||
virtualenv = url['url']
|
||||
break
|
||||
|
@ -157,8 +160,8 @@ if 1:
|
|||
|
||||
install(virtualenv, lib_dir, bin_dir)
|
||||
|
||||
print
|
||||
print 'All done!'
|
||||
print()
|
||||
print('All done!')
|
||||
|
||||
main()
|
||||
EOF
|
||||
|
|
|
@ -25,5 +25,5 @@ the return value will be `None`.
|
|||
from lektor.context import get_ctx
|
||||
|
||||
ctx = get_ctx()
|
||||
print 'The current source is %s' % ctx.source
|
||||
print('The current source is %s' % ctx.source)
|
||||
```
|
||||
|
|
|
@ -21,5 +21,5 @@ encounters a dependency it will invoke the passed function.
|
|||
deps = set()
|
||||
with get_ctx().gather_dependencies(deps.add):
|
||||
items = pad.query('/path/to/some/pages').all()
|
||||
print 'The dependencies are: %s' % deps
|
||||
print('The dependencies are: %s' % deps)
|
||||
```
|
||||
|
|
|
@ -6,7 +6,7 @@ type: property
|
|||
---
|
||||
body:
|
||||
|
||||
Because of Lektor's tree based nature it almost all records can have children
|
||||
Because of Lektor's tree based nature almost all records can have children
|
||||
below them. The `children` attribute provides a convenient way to access
|
||||
those. It returns a [Query :ref](../../query/) object that can be used to
|
||||
further filter down children.
|
||||
|
|
|
@ -9,7 +9,7 @@ type: class
|
|||
body:
|
||||
|
||||
Records are [Source Objects :ref](../obj/) that come from the `content/`
|
||||
folder and correspond to [Data Models :ref](../../../models/). The provide
|
||||
folder and correspond to [Data Models :ref](../../../models/). They provide
|
||||
a wider range of functionality compared to a standard source object but
|
||||
they also provide all the functionality a regular source object does.
|
||||
|
||||
|
|
|
@ -38,6 +38,8 @@ into a dictionary that can be dumped to JSON for instance.
|
|||
| `latitude` | The longitude as floating point value.
|
||||
| `longitude` | The longitude as floating point value.
|
||||
| `altitude` | The altitude in meters as floating point value.
|
||||
| `documentname` | The image document name as a string.
|
||||
| `description` | The image description as a string.
|
||||
|
||||
## Example
|
||||
|
||||
|
|
|
@ -18,5 +18,5 @@ as system fields which are prefixed by an underscore).
|
|||
|
||||
```python
|
||||
for child in this.children:
|
||||
print 'ID: %s' % child['_id']
|
||||
print('ID: %s' % child['_id'])
|
||||
```
|
||||
|
|
|
@ -31,5 +31,5 @@ in future versions.
|
|||
|
||||
```python
|
||||
def on_before_build(self, source, prog, **extra):
|
||||
print 'building %s' % source.source_filename
|
||||
print('building %s' % source.source_filename)
|
||||
```
|
||||
|
|
|
@ -15,5 +15,5 @@ filters and global variables.
|
|||
|
||||
```python
|
||||
def on_setup_env(self, **extra):
|
||||
env.jinja_env.globals['my_variable'] = 'my value'
|
||||
self.env.jinja_env.globals['my_variable'] = 'my value'
|
||||
```
|
||||
|
|
|
@ -32,7 +32,7 @@ from lektor.pluginsystem import Plugin
|
|||
class MyPlugin(Plugin):
|
||||
|
||||
def on_my_plugin_setup(self, foo, **extra):
|
||||
print 'got %s' % foo
|
||||
print('got %s' % foo)
|
||||
```
|
||||
|
||||
(This assumes the plugin id is set to `my-plugin` in `setup.py`)
|
||||
|
|
|
@ -10,7 +10,7 @@ body:
|
|||
|
||||
`lektor plugins add NAME`
|
||||
|
||||
This command can add a new plugion to the project. If just given
|
||||
This command can add a new plugin to the project. If just given
|
||||
the name of the plugin the latest version of that plugin is added to
|
||||
the project.
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ targeted, different files will be used. This table visualizes this:
|
|||
|
||||
## Alternatives and Paths
|
||||
|
||||
Alternatives have a special behavior with regards to paths. They alternative
|
||||
Alternatives have a special behavior with regards to paths. The alternative
|
||||
code does not exist in the path! This can be confusing at first, but has the
|
||||
advantage that they automatically work in most places as the paths are the
|
||||
same for different alternatives. For more information see
|
||||
|
|
|
@ -32,7 +32,7 @@ target = ftps://myuser:mypassword@ftp.example.com/var/www/example
|
|||
## Credentials
|
||||
|
||||
FTP is considered a largely insecure protocol for Lektor. As such if you
|
||||
want to use it you should keep your project file save as credentials will
|
||||
want to use it you should keep your project file safe as credentials will
|
||||
be most likely embedded there. Alternatively you can set the credentials
|
||||
via the command line with the `--username` and `--password` option (or via the
|
||||
environment variables `LEKTOR_DEPLOY_USERNAME` and `LEKTOR_DEPLOY_PASSWORD`)
|
||||
|
|
|
@ -44,15 +44,18 @@ with behavior for GitHub Pages.
|
|||
|
||||
## CNAME Support
|
||||
|
||||
If you want to use a [CNAME :ext](https://en.wikipedia.org/wiki/CNAME) with
|
||||
GitHub pages and Lektor you can provide the intended CNAME with the `?cname`
|
||||
parameter:
|
||||
If you want to use a custom domain with GitHub pages (also known as a
|
||||
[CNAME :ext](https://en.wikipedia.org/wiki/CNAME)), provide the intended
|
||||
CNAME in the target URL using the `?cname` parameter:
|
||||
|
||||
```ini
|
||||
[servers.production]
|
||||
target = ghpages://your-user/your-repository?cname=www.example.com
|
||||
```
|
||||
|
||||
Note that this will overwrite whatever custom domain you may have set on
|
||||
GitHub with every deployment.
|
||||
|
||||
For more information about how CNAMEs work with GitHub you can read about
|
||||
the feature in the GitHub help center:
|
||||
[Adding a CNAME file to your repository
|
||||
|
|
|
@ -32,7 +32,7 @@ To enable support for Lektor you need to create a `.gitlab-ci.yml` config
|
|||
next to your `.lektorproject` file with the following contents:
|
||||
|
||||
```yaml
|
||||
image: python:2.7
|
||||
image: python:latest
|
||||
|
||||
pages:
|
||||
script:
|
||||
|
|
|
@ -24,7 +24,7 @@ file into your repository. You can copy paste this over:
|
|||
|
||||
```yaml
|
||||
language: python
|
||||
python: 2.7
|
||||
python: 3.5
|
||||
install: "pip install Lektor"
|
||||
script: "lektor build"
|
||||
deploy:
|
||||
|
@ -45,7 +45,7 @@ in the project file would be to use `ghpages+https` like this:
|
|||
|
||||
```ini
|
||||
[servers.ghpages]
|
||||
target = ghpages+https://username/repository
|
||||
target = ghpages+https://username/repository.git
|
||||
```
|
||||
|
||||
You need to add this to your `.lektorproject` file.
|
||||
|
@ -115,7 +115,7 @@ caching. Adjust your `.travis.yml` file to look like this:
|
|||
|
||||
```yaml
|
||||
language: python
|
||||
python: 2.7
|
||||
python: 3.5
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/pip
|
||||
|
@ -135,7 +135,7 @@ config:
|
|||
|
||||
```yaml
|
||||
language: python
|
||||
python: 2.7
|
||||
python: 3.5
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cache/pip
|
||||
|
|
|
@ -43,6 +43,6 @@ get the comment box:
|
|||
<div class="comments">{{ render_disqus_comments() }}</div>
|
||||
```
|
||||
|
||||
Optionally the function accepts two arguemnts: `identifier` and
|
||||
Optionally the function accepts two arguments: `identifier` and
|
||||
`url` to override the defaults. For more information have a look at
|
||||
the disqus widget documentation.
|
||||
|
|
|
@ -36,7 +36,7 @@ For more information about this you can read the [Project File Documentation
|
|||
|
||||
## Creating an Error Page
|
||||
|
||||
You can create easy create a 404 page by creating a `404.html/contents.lr`
|
||||
You can easily add a 404 page by creating a `404.html/contents.lr`
|
||||
file. If you do not care much about the contents and structure of the file
|
||||
you can just point it to an empty model (`none`) and manually select a
|
||||
`404.html` template like this:
|
||||
|
|
|
@ -93,7 +93,7 @@ _model: doc-pages
|
|||
_hidden: yes
|
||||
```
|
||||
|
||||
This will set up our index model and our doc-pages model for the `docs/`
|
||||
This will set up our index model and our doc-pages model for the `doc/`
|
||||
folder. The latter is also set to `_hidden` which will make Lektor prevent
|
||||
the generation of those files: they are invisible. So we need to find other
|
||||
ways to render them.
|
||||
|
@ -108,7 +108,7 @@ need to query for all the other pages we have below `doc/`:
|
|||
{% extends "layout.html" %}
|
||||
{% block title %}{{ this.title }}{% endblock %}
|
||||
{% block body %}
|
||||
{% set pages = site.query('/doc').all() %}
|
||||
{% set pages = site.query('/doc').include_undiscoverable(true).all() %}
|
||||
<header>
|
||||
<h1>{{ this.title }}</h1>
|
||||
<nav>
|
||||
|
|
|
@ -34,12 +34,33 @@ Now you need to configure webpack. The plugin expects a webpack project in the
|
|||
|
||||
### `package.json`
|
||||
|
||||
This file instructs `npm` which packages we will need. All we need for a
|
||||
start is to create an almost empty file:
|
||||
This file instructs `npm` which packages we will need.
|
||||
|
||||
[npm-init :ext](https://docs.npmjs.com/cli/init) is a command-line tool to
|
||||
interactively create a ``package.json`` file.
|
||||
|
||||
```
|
||||
$ npm init
|
||||
```
|
||||
|
||||
This will ask you a bunch of questions (invoke with ``--yes`` to use default
|
||||
values) and then generate a ``package.json`` file for you.
|
||||
|
||||
It should look similar to the following example. Please **do not** just
|
||||
copy-paste this! Instead run the tool, so that your ``package.json`` meets
|
||||
the latest format specification.
|
||||
|
||||
```json
|
||||
{
|
||||
"private": true
|
||||
"name": "lektor-example",
|
||||
"version": "0.1.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT"
|
||||
}
|
||||
```
|
||||
|
||||
|
@ -86,25 +107,28 @@ module.exports = {
|
|||
},
|
||||
devtool: '#cheap-module-source-map',
|
||||
resolve: {
|
||||
modulesDirectories: ['node_modules'],
|
||||
extensions: ['', '.js']
|
||||
modules: ['node_modules'],
|
||||
extensions: ['.js']
|
||||
},
|
||||
module: {
|
||||
loaders: [
|
||||
rules: [
|
||||
{ test: /\.js$/, exclude: /node_modules/,
|
||||
loader: 'babel-loader' },
|
||||
{ test: /\.scss$/,
|
||||
loader: ExtractTextPlugin.extract(
|
||||
'style-loader', 'css-loader!sass-loader') },
|
||||
loader: ExtractTextPlugin.extract({
|
||||
fallback: 'style-loader',
|
||||
use: 'css-loader!sass-loader' } ) },
|
||||
{ test: /\.css$/,
|
||||
loader: ExtractTextPlugin.extract(
|
||||
'style-loader', 'css-loader') },
|
||||
loader: ExtractTextPlugin.extract({
|
||||
fallback: 'style-loader',
|
||||
use: 'css-loader' } ) },
|
||||
{ test: /\.(woff2?|ttf|eot|svg|png|jpe?g|gif)$/,
|
||||
loader: 'file' }
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new ExtractTextPlugin('styles.css', {
|
||||
new ExtractTextPlugin({
|
||||
filename: 'styles.css',
|
||||
allChunks: true
|
||||
}),
|
||||
new webpack.optimize.UglifyJsPlugin()
|
||||
|
|
|
@ -30,7 +30,7 @@ the installation is a bit more involved.
|
|||
|
||||
You need to make sure you have the following software installed on your computer:
|
||||
|
||||
* Python 2.7 (**not** Python 3.x, also `python-dev`, `libssl-dev` and
|
||||
* Python 2.7 or above (also `python-dev`, `libssl-dev` and
|
||||
`libffi-dev` is required on Ubuntu)
|
||||
`sudo apt-get install python-dev libssl-dev libffi-dev`
|
||||
* ImageMagick (`brew install imagemagick` can get you this on OS X and `sudo apt-get install imagemagick`
|
||||
|
|
|
@ -36,13 +36,13 @@ label = Body
|
|||
type = markdown
|
||||
```
|
||||
|
||||
In this particular case we have a model with the id `model` (as defined by the
|
||||
In this particular case, we have a model with the id `page` (as defined by the
|
||||
filename) and a name `Page` which will appear like that in the UI. Pages that
|
||||
use this model will use the template expression `{{ this.title }}` to be
|
||||
displayed in the UI. In this case it uses the title of the page.
|
||||
displayed in the UI. In this case, it uses the title of the page.
|
||||
|
||||
There are two fields defined: a `title` and a `body`. The former is just an
|
||||
unformatted string which is show larger in the UI (`size = large`) and the
|
||||
unformatted string which is shown larger in the UI (`size = large`) and the
|
||||
latter uses markdown for rendering. This will give it a text area in the admin
|
||||
panel.
|
||||
|
||||
|
@ -62,8 +62,8 @@ The following options are used for all types:
|
|||
- `description`: an optional string that provides some description for the
|
||||
field that is shown in the UI to give a bit more explanation.
|
||||
- `addon_label`: an optional string that is supported by all types that are
|
||||
rendered as an input field. This string is shown as a UI label on the
|
||||
right side of the input field to give it more context. For instance it can
|
||||
rendered as an input field. This string is shown as an UI label on the
|
||||
right side of the input field to give it more context. For instance, it can
|
||||
be used to clarify units of a field (pixel, percent etc.).
|
||||
- `width`: defines the width of the input in the admin as a fraction. For
|
||||
instance `1/4` sets it to a quarter of the width, `1/2` to a half etc.
|
||||
|
@ -89,7 +89,7 @@ Models have the following options that can customize the model itself:
|
|||
This is very useful for models that are implied through configuration.
|
||||
- `protected`: if a model is set to protected then all of its instances
|
||||
cannot be deleted once created.
|
||||
- `inherits`: if you want to inherit all fields from another model then this
|
||||
- `inherits`: if you want to inherit all fields and model option settings from another model then this
|
||||
can be set to the name of another model.
|
||||
|
||||
In addition to that, there are some configuration sections in the model file
|
||||
|
|
|
@ -37,13 +37,21 @@ so they might not keep pace with development on Lektor.
|
|||
* [github-repos :ext](https://github.com/marksteve/lektor-github-repos):
|
||||
fetches your GitHub repos for display in Lektor templates
|
||||
* [google-analytics :ext](https://github.com/kmonsoor/lektor-google-analytics): Adds `Google Analytics` support to Lektor-generated site.
|
||||
* [atom :ext](https://github.com/ajdavis/lektor-atom): Generate Atom feeds for your content.
|
||||
* [yandex-metrica :ext](https://github.com/gagoman/lektor-yandex-metrica): Adds `Yandex Metrica` support to Lektor-generated site.
|
||||
* [atom :ext](https://github.com/dwt/lektor-atom): Generate Atom feeds for your content.
|
||||
* [surge :ext](https://github.com/ajdavis/lektor-surge): Publish your site to [Surge](https://surge.sh/).
|
||||
* [netlify :ext](https://github.com/ajdavis/lektor-netlify): Publish your site to [Netlify](https://www.netlify.com/).
|
||||
* [tags :ext](https://github.com/ajdavis/lektor-tags): For each tag on site, build a list of pages with that tag.
|
||||
* [i18n :ext](https://github.com/numericube/lektor-i18n-plugin): Use GetText .PO files to translate your site **content**.
|
||||
* [htmlmin :ext](https://github.com/vesuvium/lektor-htmlmin): Automatically minifies .html files in build directory
|
||||
* [creative-commons :ext](https://github.com/humrochagf/lektor-creative-commons): Add Creative Commons license to your pages
|
||||
* [nofollow :ext](https://github.com/yargies/lektor-nofollow): Easily create nofollow links in markdown
|
||||
* [minify :ext](https://github.com/pietroalbini/lektor-minify): Minify changed files automatically during the build
|
||||
* [asciidoc :ext](https://github.com/ajdavis/lektor-asciidoc/): Add asciidoc field type
|
||||
* [shortcodes :ext](https://github.com/skorokithakis/lektor-shortcodes): A plugin allowing you to use shortcodes (something like tags) in your model fields
|
||||
* [thumbnail-generator :ext](https://github.com/skorokithakis/lektor-thumbnail-generator): A plugin allowing you to generate configurable thumbnails for all your attachment images, so you can link them in your posts
|
||||
* [rst :ext](https://github.com/fschulze/lektor-rst): A [reStructuredText](http://docutils.sourceforge.net) plugin
|
||||
* [make :ext](https://github.com/BarnabyShearer/lektor-make): Run `make lektor` for custom build systems
|
||||
|
||||
! Have your own plugin and you want to see it here? Just [edit this page
|
||||
on GitHub :ref](https://github.com/lektor/lektor-website/edit/master/content/docs/plugins/list/contents.lr),
|
||||
|
|
|
@ -23,6 +23,25 @@ the query. For instance this iterates over all attached images of a page:
|
|||
<div class="image"><img src="{{ image|url }}"></div>
|
||||
{% endfor %}
|
||||
```
|
||||
<br/>
|
||||
To access images from a different content folder, you would use:
|
||||
|
||||
```html+jinja
|
||||
{% for image in site.get('/myfolder').attachments.images %}
|
||||
<div class="image"><img src="{{ image|url }}"></div>
|
||||
{% endfor %}
|
||||
```
|
||||
<br/>
|
||||
To retrieve only a specific image or attachment with a certain name you would use
|
||||
|
||||
```html+jinja
|
||||
{% set my_image site.get('/myfolder').attachments.get('imagenameexample.jpg') %}
|
||||
<div class="image"><img src="{{ my_image|url }}"></div>
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## Accessing Image Data
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ a page. This is easy to accomplish as well:
|
|||
```html+jinja
|
||||
<nav>
|
||||
<ul class="nav">
|
||||
{% for project in site.get('/projects') %}
|
||||
{% for project in site.get('/projects').children %}
|
||||
<li{% if this == project %} class="active"{% endif
|
||||
%}><a href="{{ project|url }}">{{ project.name }}</a></li>
|
||||
{% endfor %}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
title: Themes
|
||||
---
|
||||
sort_key: 95
|
||||
---
|
||||
summary: A quick introduction into Lektor Themes.
|
||||
---
|
||||
body:
|
||||
|
||||
!!!! This is under development and isn't released yet. It should be considered
|
||||
unstable and could change in the future.
|
||||
|
||||
Lektor provides a themes system to easily implement, reuse, and distribute themes.
|
||||
This allows you to use assets, templates, models, and / or flowblocks built into the theme.
|
||||
Themes are created by the Lektor community.
|
||||
|
||||
Lektor themes work like an extension of the project, allowing you to easily adopt features of the theme such as styles, models, or templates.
|
|
@ -0,0 +1,117 @@
|
|||
title: Creating a Theme
|
||||
---
|
||||
sort_key: 30
|
||||
---
|
||||
summary: Explains themes structure and theme.ini file.
|
||||
---
|
||||
body:
|
||||
|
||||
!!!! Not implemented yet.
|
||||
|
||||
You could create a basic empty theme with the following command:
|
||||
|
||||
```bash
|
||||
$ lektor new theme <theme-name>
|
||||
```
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
$ lektor new theme demo-theme
|
||||
```
|
||||
|
||||
|
||||
## Theme Components:
|
||||
|
||||
A theme could provide templates, assets, and models (also flowblocks):
|
||||
|
||||
```
|
||||
demo-theme
|
||||
├── assets
|
||||
├── models
|
||||
├── templates
|
||||
└── flowdocks
|
||||
```
|
||||
|
||||
## The theme_settings Variable
|
||||
|
||||
A `theme_settings` section in `.lektorproject` file could be used to
|
||||
parametrize themes:
|
||||
|
||||
```ini
|
||||
[theme_settings]
|
||||
name = "Lektor"
|
||||
github_url = "https://github.com/lektor"
|
||||
```
|
||||
|
||||
And those settings will be accessed in templates through the config env
|
||||
variable:
|
||||
```jinja
|
||||
{{ config.theme_settings.<variable_name> }}
|
||||
```
|
||||
Example:
|
||||
```jinja
|
||||
<a href="{{ config.theme_settings.github_url }}">Github</a>
|
||||
|
||||
```
|
||||
will output:
|
||||
```
|
||||
<a href="https://github.com/lektor/lektor">Github</a>
|
||||
```
|
||||
|
||||
## The theme.ini File
|
||||
|
||||
Themes could provide a `theme.ini` file, that is optional, but it's required if
|
||||
you want to add your theme to the lektor community themes.
|
||||
|
||||
Example:
|
||||
|
||||
```ini
|
||||
name = "Demo theme"
|
||||
license = "MIT"
|
||||
licenselink = "https://github.com/lektor/lektor-demo-theme/blob/master/LICENSE.md"
|
||||
description = "Simple, minimal theme for Lektor "
|
||||
homepage = "https://github.com/lektor/lektor-demo-theme"
|
||||
tags = "simple,minimal,demo"
|
||||
features = "blog"
|
||||
lektor_minimum_required_version = 3.1
|
||||
|
||||
[author]
|
||||
name = "lektor"
|
||||
homepage = "http://getlektor.com/"
|
||||
|
||||
[original]
|
||||
author = ""
|
||||
homepage = ""
|
||||
repo = ""
|
||||
|
||||
[packages]
|
||||
lektor-disqus-comments = 0.2
|
||||
```
|
||||
|
||||
The `[original]` section is only required if you are porting an existing theme.
|
||||
|
||||
!!!! Not implemented yet
|
||||
|
||||
The `lektor_minimum_required_version` is used by Lektor to check the
|
||||
compatibility when installing a theme.
|
||||
|
||||
## Releasing a Theme
|
||||
|
||||
!!!! Not implemented yet
|
||||
|
||||
You could add a theme to Lektor community theme, open a pull request against
|
||||
(lektor themes)[https://github.com/lektor/lektor-themes] adding it as a git
|
||||
submodule.
|
||||
|
||||
You should also include an `images/` folder with a screenshot and a thumbnail:
|
||||
|
||||
```
|
||||
demo-theme
|
||||
└── images
|
||||
├── thumbnail.png
|
||||
└── screenshot.png
|
||||
```
|
||||
|
||||
Themes added to this lektor-themes repository, will automatically be added to the
|
||||
lektor website.
|
|
@ -0,0 +1,20 @@
|
|||
title: Customizing a Theme
|
||||
---
|
||||
sort_key: 20
|
||||
---
|
||||
summary: Explains how models, templates, or assets could be overrided.
|
||||
---
|
||||
body:
|
||||
|
||||
You could personalize a theme by overriding files, for example if a theme
|
||||
provides a blog model in:
|
||||
|
||||
```
|
||||
/themes/<theme>/models/blog.ini
|
||||
```
|
||||
|
||||
You could override it by creating a blog model:
|
||||
|
||||
```
|
||||
/models/blog.ini
|
||||
```
|
|
@ -0,0 +1,74 @@
|
|||
title: Installing a Theme
|
||||
---
|
||||
sort_key: 10
|
||||
---
|
||||
summary: Explains how to install Lektor themes.
|
||||
---
|
||||
body:
|
||||
|
||||
For installing a theme you just need to copy it to the `themes/` folder
|
||||
|
||||
```
|
||||
project
|
||||
├── assets
|
||||
├── models
|
||||
├── content
|
||||
...
|
||||
└── themes
|
||||
└── lektor-theme-nix
|
||||
```
|
||||
|
||||
Themes are normally distributed by public Git repositories, so you could install a theme by
|
||||
cloning the repo:
|
||||
|
||||
```bash
|
||||
cd themes
|
||||
git clone URL_TO_THEME_REPO
|
||||
```
|
||||
|
||||
For example, for installing `lektor-theme-nix`:
|
||||
```bash
|
||||
cd themes
|
||||
git clone https://github.com/rlaverde/lektor-theme-nix.git
|
||||
```
|
||||
|
||||
If you download several themes, setting `themes` variable will allow you to only load
|
||||
a particular theme.
|
||||
|
||||
!!!! Not implemented yet.
|
||||
|
||||
You could add the `themes` variable to the `.lektorproject` file and Lektor will
|
||||
search in the (community themes)[/themes] and automatically install it.
|
||||
|
||||
```ini
|
||||
[project]
|
||||
themes = lextor-theme-nix
|
||||
```
|
||||
|
||||
## Installing Multiple Themes
|
||||
|
||||
Lektor also supports installing several themes. Copy them to the `themes/`
|
||||
folder, and set the `themes` variable to indicate the precedence (optional).
|
||||
|
||||
```
|
||||
project
|
||||
├── assets
|
||||
├── models
|
||||
├── content
|
||||
...
|
||||
└── themes
|
||||
├── lektor-theme-other-theme/
|
||||
└── lektor-theme-nix/
|
||||
```
|
||||
|
||||
```ini
|
||||
[project]
|
||||
themes = lextor-theme-nix, lektor-theme-other-theme
|
||||
```
|
||||
|
||||
This will make `lektor-theme-nix`, 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)
|
||||
theme is preferred over the theme(s) to its right.
|
||||
|
||||
!! If you don't set the `themes` variable, all themes will be loaded, but the order
|
||||
isn't preserved.
|
|
@ -0,0 +1,22 @@
|
|||
title: Installing Plugins with a Theme.
|
||||
---
|
||||
sort_key: 40
|
||||
---
|
||||
summary: Explains how a theme could depend or include several plugins.
|
||||
---
|
||||
body:
|
||||
|
||||
!!!! Not implemented yet.
|
||||
|
||||
Themes could depend on [plugins](../../plugins), and they will be loaded along
|
||||
the theme.
|
||||
|
||||
1. You could use the `[packages]` section of the `theme.ini` to install
|
||||
released packages:
|
||||
```ini
|
||||
[packages]
|
||||
lektor-disqus-comments = 0.2
|
||||
```
|
||||
|
||||
2. Plugins can be added to the `packages/` folder in the theme. Each plugin has
|
||||
to go into a separate folder.
|
|
@ -32,17 +32,17 @@ traffic a static website will stay up for longer on the same server than a
|
|||
dynamic one that needs to execute code.
|
||||
|
||||
Sure, there are some things you cannot do on a static website, but those are not
|
||||
things you would not use Lektor for. For small dynamic sections, JavaScript
|
||||
things you would use Lektor for. For small dynamic sections, JavaScript
|
||||
paired up with other services is a good solution.
|
||||
|
||||
<img src="static.png" alt="" class="screenshot">
|
||||
|
||||
## Lektor is a CMS
|
||||
|
||||
However, Lektor also takes from content management systems like WordPress
|
||||
and provides a flexible browser-based admin interface from which you can
|
||||
edit your website's contents. Unlike traditional CMS solutions, however, it
|
||||
runs entirely on your own computer.
|
||||
Lektor takes from content management systems like WordPress and provides a
|
||||
flexible browser-based admin interface from which you can edit your website's
|
||||
contents. Unlike traditional CMS solutions, however, it runs entirely on your
|
||||
own computer.
|
||||
|
||||
This means you can give a Lektor website to people that have no understanding
|
||||
of programming and they can still modify the content and update the website.
|
||||
|
|
Before Width: | Height: | Size: 653 KiB |
Before Width: | Height: | Size: 569 KiB |
Before Width: | Height: | Size: 246 KiB |
|
@ -1,9 +0,0 @@
|
|||
name: A. Jesse Jiryu Davis
|
||||
---
|
||||
url: http://emptysqua.re
|
||||
---
|
||||
description:
|
||||
|
||||
I ported my site, with hundreds of pages, from my own overpowered dynamic framework to a static site built by Lektor and hosted on GitHub pages. I don't pay hosting fees now, and the site's prettier too.
|
||||
---
|
||||
cover_image: 1-blog-post.png
|
After Width: | Height: | Size: 71 KiB |
|
@ -0,0 +1,9 @@
|
|||
name: Eswar Malla
|
||||
---
|
||||
cover_image: home_page.png
|
||||
---
|
||||
description:
|
||||
|
||||
I am using lektor for my personal blog. In the process I also ported a jekyll theme(pixyll) to be used with lektor, which you can find it [here](https://github.com/eswarm/piktor) and preview [here](http://eswarm.in/piktor/). One of the primary reasons for moving to lektor for me is the admin panel provided.
|
||||
---
|
||||
url: http://eswarm.in
|
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 57 KiB |
After Width: | Height: | Size: 40 KiB |
|
@ -0,0 +1,14 @@
|
|||
name: Playwarwick
|
||||
---
|
||||
description:
|
||||
|
||||
Website for Warwick, a terminal-based strategy game.
|
||||
|
||||
Lektor is used as templating engine and content manager, while Grunt is used
|
||||
for minification and assets manipulation.
|
||||
|
||||
[View the Sourcecode on GitHub](https://github.com/lurebound/playwarwick)
|
||||
---
|
||||
url: https://playwarwick.com
|
||||
---
|
||||
cover_image: 1-home.png
|
After Width: | Height: | Size: 286 KiB |
After Width: | Height: | Size: 315 KiB |
After Width: | Height: | Size: 325 KiB |
|
@ -0,0 +1,8 @@
|
|||
name: Yargies Games
|
||||
---
|
||||
description:
|
||||
Yargies Games is where I showcase my mobile games and blog. I knew I wanted to use a static site generator to build the site and I chose Lektor because of it's flexibility. I deploy to S3 and Cloudfront using the [lektor-s3](https://github.com/spenczar/lektor-s3) plugin. Hosting is fast, cheap and worry-free with Lektor.
|
||||
---
|
||||
url: http://yargies.com
|
||||
---
|
||||
cover_image: 1-home.png
|
|
@ -60,8 +60,8 @@
|
|||
<a href="https://gitter.im/lektor/lektor" title="Chat on Gitter"
|
||||
><i class="fa fa-comment"></i></a>
|
||||
{%- if this.path %}
|
||||
<a href="https://github.com/lektor/lektor-website/tree/master/content{{ this.path.split('@')[0]
|
||||
}}/contents.lr" title="View source for this page"><i class="fa fa-code"></i></a>
|
||||
<a href="https://github.com/lektor/lektor-website/tree/master/content{% if this.path != '/'
|
||||
%}{{ this.path.split('@')[0]}}{% endif %}/contents.lr" title="View source for this page"><i class="fa fa-code"></i></a>
|
||||
{%- endif %}
|
||||
</div>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
<p>
|
||||
<small>You want your own website on here? <a
|
||||
href="https://github.com/lektor/lektor-website/tree/master/content/showcase">Fork
|
||||
the Lektor Website Repository on GitHub</a> to add your own project. Make sure to
|
||||
add screenshots and a description about the project.</small>
|
||||
the Lektor Website Repository on GitHub</a> to add your own project.
|
||||
Make sure to add screenshots and a description about the project.
|
||||
We encourage you to add a link to your source code so that others can
|
||||
learn from your example.
|
||||
</small>
|
||||
{% endblock %}
|
||||
|
|