Files
@ 14dfff128751
Branch filter:
Location: AENC/cwi-pelican-template-fork/README.txt
14dfff128751
15.2 KiB
text/plain
Changes facilitate publication, e.g., SITEURL defined in publishconf.py, URLs suffixes removed and Makefile SSH variable assigned realistic values.
Changes to be committed:
modified: Makefile
new file: content/extras/top-htaccess
modified: pelicanconf.py
modified: publishconf.py
Changes to be committed:
modified: Makefile
new file: content/extras/top-htaccess
modified: pelicanconf.py
modified: publishconf.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | Introduction
============
Pelican is a static site generator written in Python.
This repository contains a pre-fabricated Pelican project and theme
you can use as a foundation on which to build your own static HTML
websites.
Pelican, together with Git and rsync, make it easy to compose, archive
and deploy static HTML websites.
Installing Pelican
==================
The easiest way to install Pelican is within a python virtual
environment. You can create a virtual environment à la carte with
`virtualenv <https://virtualenv.pypa.io/en/latest/>`_ , or manage
several virtual environments under a single directory with
`virtualenvwrapper <http://virtualenvwrapper.readthedocs.org/en/latest/>`_::
virtualenv cwi-pelican
cd cwi-pelican
. ./bin/activate
Once your virtual environment has been created and activated, use pip
to install Pelican and its dependencies::
pip install pelican
If you plan on using Markdown as a markup format, you’ll need to
install the Markdown library::
pip install Markdown
Typographical enhancements can be enabled in your settings file, but
first the requisite Typogrify library must be installed::
pip install typogrify
Installing the Pelican Project Template
---------------------------------------
To kick start your website development, we have created a
pre-fabricated Pelican theme and project template with example
content. While you can install the template anywhere you like, for
this example, please clone the cwi-pelican-template Git repository in
the root of your Pelican virtual environment.
You can clone the cwi-pelican template in one of two ways. First, you
can fork the repository directly in the Rhodecode server. Point your
browser to https://scm.cwi.nl/ITF/cwi-pelican-template, choose 'Fork'
from the options menu, rename your clone, choose your repository group
and click 'Fork this Repository.' We recommend this method since is
assures that your clone resides on CWI's Rhodecode server. Now clone
your fork to your local machine. Don't forget to use your fork's url::
git clone https://guravage@scm.cwi.nl/ITF/cwi-pelican-template-fork cwi
Second, you can clone the template directly to your local machine::
git clone https://guravage@scm.cwi.nl/ITF/cwi-pelican-template cwi
This clone resides on your local machine. Its origin is read-only, so
you'll have to create a remote repository somewhere and reassign your
clone's origin to point to your new remote repository before you can
push your changes. See the 'Archiving your site' section below for
instructions how to create a remote Rhodecode repository.
Installing the Pelican CWI Theme
--------------------------------
The cwi project template uses the CWI theme - included in the repository.
Install the theme so Pelican knows where to find it::
pelican-themes --symlink ${PWD}/cwi/themes/cwi
pelican-themes --list -v
Alternatively - ITF can Install Pelican on Your Desktop
-------------------------------------------------------
If you do not want to customize the CWI theme, ITF can install Pelican
directly on your desktop machine. New sites are created with Pelican's
own quickstart script::
pelican-quickstart
To use the CWI theme merely add THEME = 'cwi' to your site's
pelicanconf.py configuration file.
The first installation method relies on forking a repository; this
alternative method does not. It is incumbent upon you to make sure
your sites are properly archived.
Usage
=====
To generate html output, go to the project/cwi directory and invoke
Pelican via make::
cd cwi/projects/cwi
make html
Previewing
----------
Pelican has its own built-in server; which you invoke with
make. Better yet, generate and serve the HTML in one command::
make html serve
The server uses port 8000 by default. After starting the server, point
you browser to the url: http://127.0.0.1:8000/.
Customizing Configuration Settings
----------------------------------
Pelican has a plethora of setting; all configurable in file named
'pelicanconf.py.' Please refer to `the settings section
<http://docs.getpelican.com/en/3.5.0/settings.html>`_ in the Pelican
documentation.
Here is the contents of pelicanconf.py used in the cwi project
template. Observe that the 'THEME' setting is assigned the string
'cwi'::
#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
AUTHOR = u'M.A. Guravage'
SITENAME = u'CWI Pelican Template'
SITEURL = ''
PATH = 'content'
TIMEZONE = 'Europe/Amsterdam'
DEFAULT_LANG = u'en'
# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None
# Blogroll
LINKS = (('Pelican', 'http://getpelican.com/'),
('Python.org', 'http://python.org/'),
('Jinja2', 'http://jinja.pocoo.org/'),)
# Social widget
SOCIAL = (('twitter', 'https://twitter.com/CWInl'),
('github', 'http://github.com'),)
STATIC_PATHS = ['static', 'images', 'extras/.htaccess', 'extras/.htpassword']
PAGE_PATHS = ['pages','news', 'private']
ARTICLE_PATHS = ['blog']
DEFAULT_PAGINATION = 10
THEME = 'cwi'
USE_FOLDER_AS_CATEGORY = True
DISPLAY_CATEGORIES_ON_MENU = False
DISPLAY_PAGES_ON_MENU = True
LOAD_CONTENT_CACHE = False
EXTRA_PATH_METADATA = {
'extras/.htaccess': {'path': 'pages/.htaccess'},
'extras/.htpassword': {'path': 'pages/.htpassword'}
}
# Uncomment following line if you want document-relative URLs when developing
#RELATIVE_URLS = True
# finis
Uploading the Generated HTML to a Server
----------------------------------------
The Pelican Makefile contains several targets for uploading its
generated HTML. List all make's targets with::
make -n
To use rsync, edit the Makefile and customize the values of SSH_HOST,
SSH_USER and SSH_Target_DIR.
If CWI is hosting your site, SSH_HOST and SSH_TARGET_DIR name the host
and document root configured for you by ITF staff.
Archiving Your Site
-------------------
the url from which you cloned the cwi-pelican-template repository is
called the clone's 'origin.' If you forked your clone you already have
a remote repository on CWI's Rhodecode server. Your local clone knows
what its origin is, and you can push your changes directly to it. If,
however, you merely cloned the repository, you must change its origin
to point to a different remote repository before you can push your
changes. For example, if I had created a new repository at
scm.cwi.nl named itf-pelican-site, I would change the origin of my
local clone with the following command::
git remote add origin https://guravage@scm.cwi.nl/ITF/itf-pelican-site
Afterwards I could push my changes to my remote, whether forked or
new, with the following command::
git push -u origin master
Creating new Pelican projects
-----------------------------
Pelican provides a scrip, appropriately named 'pelican-quickstart', to
help create new project hierarchies. To use it, open a terminal
window, go to the projects directory and invoke 'pelican-quickstart.'
The script will solicit your answers to several questions, and
generate your new project hierarchy accordingly.
The CWI Template and Theme
==========================
The project content is a hierarchy of folders and files containing
your content, the CWI theme and the Pelican generated HTML.
Content Hierarchy
-----------------
The first and most important hierarchy is the one that holds the
content of your website. Here is where you add your content that
becomes pages on your static website. Browse through the content
hierarchy to familiarize yourself with its structure and contents.
Folder names become Pelican categories, so folders named, 'blog',
'news', 'pages', 'private' and 'static' contain exactly what you
expect them to have. By default, files in the blog folder are
displayed on the index page. Files in the pages folder produce
corresponding tabs. The events.md file contains explicit links to
files in the news folder. The about.md file contains a link to a
static PDF file.
You can customize how Pelican will handle your content by editing the
configuration files: pelicanconf.py and publishconf.py::
├── projects
│ ├── cwi
│ │ ├── pelicanconf.py
│ │ ├── publishconf.py
│ │ ├── develop_server.sh
│ │ ├── fabfile.py
│ │ ├── Makefile
│ │ ├── content
│ │ │ ├── blog
│ │ │ │ └── cwi.md
│ │ │ ├── extras
│ │ │ │ ├── .htaccess
│ │ │ │ ├── .htpassword
│ │ │ ├── images
│ │ │ ├── news
│ │ │ │ ├── energy_projects.md
│ │ │ │ ├── jos_baeten_uva.md
│ │ │ │ └── linda_hardman_acm.md
│ │ │ ├── pages
│ │ │ │ ├── about.md
│ │ │ │ ├── contact.md
│ │ │ │ ├── events.md
│ │ │ │ └── news.md
│ │ │ ├── private
│ │ │ │ └── private.md
│ │ │ └── static
│ │ │ └── annual-report.pdf
CWI Theme Hierarchy
-------------------
You need not change anything here. But if the need arises, here is
where you will affect your changes to the theme::
├── themes
├── cwi
│ ├── static
│ │ ├── css
│ │ │ ├── main.css
│ │ │ ├── pygment.css
│ │ │ ├── reset.css
│ │ │ ├── typogrify.css
│ │ │ └── wide.css
│ │ └── images
│ │ └── icons
│ │ ├── aboutme.png
│ │ ├── bitbucket.png
│ │ ├── cwi.jpg
│ │ ├── delicious.png
│ │ ├── facebook.png
│ │ ├── github.png
│ │ ├── gitorious.png
│ │ ├── gittip.png
│ │ ├── google-groups.png
│ │ ├── google-plus.png
│ │ ├── hackernews.png
│ │ ├── lastfm.png
│ │ ├── linkedin.png
│ │ ├── reddit.png
│ │ ├── rss.png
│ │ ├── slideshare.png
│ │ ├── speakerdeck.png
│ │ ├── stackoverflow.png
│ │ ├── twitter.png
│ │ ├── vimeo.png
│ │ └── youtube.png
│ └── templates
│ ├── analytics.html
│ ├── archives.html
│ ├── article.html
│ ├── article_infos.html
│ ├── author.html
│ ├── authors.html
│ ├── base.html
│ ├── base.html~
│ ├── category.html
│ ├── comments.html
│ ├── disqus_script.html
│ ├── github.html
│ ├── index.html
│ ├── page.html
│ ├── period_archives.html
│ ├── piwik.html
│ ├── tag.html
│ ├── taglist.html
│ ├── tags.html
│ ├── translations.html
│ └── twitter.html
Output Hierarchy
----------------
Here is the structure of the HTML Pelican generates::
├── projects
│ ├── cwi
│ │ ├── output
│ │ │ ├── about.html
│ │ │ ├── archives.html
│ │ │ ├── author
│ │ │ │ └── moe-howard.html
│ │ │ ├── authors.html
│ │ │ ├── categories.html
│ │ │ ├── category
│ │ │ │ └── blog.html
│ │ │ ├── feeds
│ │ │ │ ├── all.atom.xml
│ │ │ │ └── blog.atom.xml
│ │ │ ├── index.html
│ │ │ ├── pages
│ │ │ │ ├── .htaccess
│ │ │ │ ├── .htpassword
│ │ │ │ ├── about.html
│ │ │ │ ├── contact.html
│ │ │ │ ├── energy_project.html
│ │ │ │ ├── events.html
│ │ │ │ ├── jos_baeten.html
│ │ │ │ ├── lynda_Hardman.html
│ │ │ │ ├── news.html
│ │ │ │ └── private.html
│ │ │ ├── static
│ │ │ │ └── annual-report.pdf
│ │ │ ├── tags.html
│ │ │ └── theme
│ │ │ ├── css
│ │ │ │ ├── main.css
│ │ │ │ ├── main.css~
│ │ │ │ ├── pygment.css
│ │ │ │ ├── reset.css
│ │ │ │ ├── typogrify.css
│ │ │ │ └── wide.css
│ │ │ └── images
│ │ │ └── icons
│ │ │ ├── aboutme.png
│ │ │ ├── bitbucket.png
│ │ │ ├── cwi.jpg
│ │ │ ├── cwi_orig.jpg
│ │ │ ├── delicious.png
│ │ │ ├── facebook.png
│ │ │ ├── github.png
│ │ │ ├── gitorious.png
│ │ │ ├── gittip.png
│ │ │ ├── google-groups.png
│ │ │ ├── google-plus.png
│ │ │ ├── hackernews.png
│ │ │ ├── lastfm.png
│ │ │ ├── linkedin.png
│ │ │ ├── reddit.png
│ │ │ ├── rss.png
│ │ │ ├── slideshare.png
│ │ │ ├── speakerdeck.png
│ │ │ ├── stackoverflow.png
│ │ │ ├── twitter.png
│ │ │ ├── vimeo.png
│ │ │ └── youtube.png
Pelican Documentation
=====================
You will find answers to all your Pelican questions in the Pelican
documentation. You will find the Pelican documentation at
http://docs.getpelican.com/en/3.5.0/.
|