GithubHelp home page GithubHelp logo

getpelican / pelican Goto Github PK

View Code? Open in Web Editor NEW
12.2K 341.0 1.8K 6.82 MB

Static site generator that supports Markdown and reST syntax. Powered by Python.

Home Page: https://getpelican.com

License: GNU Affero General Public License v3.0

Python 89.23% CSS 8.86% Jinja 1.91%
static-site-generator python pelican

pelican's Introduction

Pelican PyPI: the Python Package Index Monthly Downloads from PyPI Repology: the packaging hub

Pelican is a static site generator, written in Python, that allows you to create web sites by composing text files in formats such as Markdown, reStructuredText, and HTML.

With Pelican, you can create web sites without worrying about databases or server-side programming. Pelican generates static sites that can be served via any web server or hosting service.

You can perform the following functions with Pelican:

  • Compose content in Markdown or reStructuredText using your editor of choice
  • Simple command-line tool (re)generates HTML, CSS, and JS from your source content
  • Easy to interface with version control systems and web hooks
  • Completely static output is simple to host anywhere

Features

Pelican’s feature highlights include:

  • Chronological content (e.g., articles, blog posts) as well as static pages
  • Integration with external services
  • Site themes (created using Jinja2 templates)
  • Publication of articles in multiple languages
  • Generation of Atom and RSS feeds
  • Code syntax highlighting via Pygments
  • Import existing content from WordPress, Dotclear, or RSS feeds
  • Fast rebuild times due to content caching and selective output writing
  • Extensible via a rich plugin ecosystem: Pelican Plugins

Check out the Pelican documentation for further information.

How to get help, contribute, or provide feedback

See our contribution submission and feedback guidelines.

Source code

Pelican’s source code is hosted on GitHub. For information on how it works, have a look at Pelican's internals.

Why the name “Pelican”?

“Pelican” is an anagram of calepin, which means “notebook” in French.

pelican's People

Contributors

almet avatar andreacrotti avatar avaris avatar bbinet avatar botpub avatar davidjb avatar derdon avatar freeculturexx avatar ikeviny avatar ingwinlu avatar jawher avatar jorgesumle avatar justinmayer avatar kylef avatar lothiraldan avatar mankyd avatar mapio avatar meirkriheli avatar minchinweb avatar mosra avatar nduhamel avatar nrocco avatar onlyhavecans avatar oulenz avatar rogdham avatar saimn avatar scheirle avatar smartass101 avatar svetlyak40wt avatar wking avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pelican's Issues

Even if PATH is specified you need path on the command line

As the title suggests, if you have PATH in the configuration file, you should be able not to specify it on the command line.

To have it happen you need to add

, nargs='?',

in __init__.py line 84 (where you add the path argument), moreover you should change

    if path.endswith('/'):

in

    if path and path.endswith('/'):

in line 13 (inside init_params) so that in case the user has not given a path you don't call endswith on None.

I would send in a patch, or fork, but it seems a bit too much for such a small change. Beside the fact that I don't use git normally…

Insert blank index.html files in folders

I think it would be good to insert empty html files in /tag /category /pages folders.

If we go on {SITEURL}/pages we have the list of all html pages. Users wouldn't have to make a .htaccess file to disable them.

Archive order

I think it would be great to be able to choose the ordering of the articles : older or newer at top.

What do you think ?

Bug with new version

I upgraded my pelican version today, and I had this bug which erase all my blog folder

File "../pelican/bin/pelican", line 37, in
generator.run(processors)
File "/usr/local/lib/python2.6/dist-packages/pelican-2.5.0-py2.6.egg/pelican/generators.py", line 65, in run
p.process(context, self)
File "/usr/local/lib/python2.6/dist-packages/pelican-2.5.0-py2.6.egg/pelican/processors.py", line 108, in process
self.generate_feeds(context, generator)
File "/usr/local/lib/python2.6/dist-packages/pelican-2.5.0-py2.6.egg/pelican/processors.py", line 36, in generate_feeds
generator.generate_feed(self.articles, context, context['FEED'])
File "/usr/local/lib/python2.6/dist-packages/pelican-2.5.0-py2.6.egg/pelican/generators.py", line 94, in generate_feed
categories=element.tags,
AttributeError: 'Article' object has no attribute 'tags'

I precise i didn't put any tags on my article. Are they necessary ? Will it be ok if I create tag on all my articles ?

Relative image addresses messed up when browsing categories

Hey,

Say I add an image in my article, giving it a relative address, like content/my_image.jpg.
My article has a category category.

It works well in the root directory, but since the articles also appear in the categories, the relative address which was content/my_image.jpg is now translated in category/content/my_image.jpg.

I see one solution, using the site address to handle these kind of relative addresses: we simply prefix the relative address with the SITEURL value.

Layout problem with links in notmyidea theme

I saw that when I only had 5 links the layout becomes bad. The first two are well arranged, but then the others are not aligned and have no border-bottom.

I found it on 2.5.3 release and repository.

trying to use simple theme gives an exception

when running
pelican -t simple prog/dvcs/git/pelican/samples/content/

it gives

 [ok] writing /home/solstice/output/feeds/all.atom.xml
 [ok] writing /home/solstice/output/feeds/prog/dvcs/git/pelican/samples/content.atom.xml
 [ok] writing /home/solstice/output/feeds/bar.atom.xml
 [ok] writing /home/solstice/output/feeds/yeah.atom.xml
Traceback (most recent call last):
  File "/usr/bin/pelican", line 39, in <module>
    generator.run(processors)
  File "/usr/lib/python2.7/site-packages/pelican/generators.py", line 53, in run
    p.process(context, self)
  File "/usr/lib/python2.7/site-packages/pelican/processors.py", line 97, in process
    self.generate_pages(context, generator)
  File "/usr/lib/python2.7/site-packages/pelican/processors.py", line 46, in generate_pages
    templates = generator.get_templates()
  File "/usr/lib/python2.7/site-packages/pelican/generators.py", line 122, in get_templates
    template, path))
Exception: Unable to load page.html from /usr/lib/python2.7/site-packages/pelican/themes/simple/templates

Pagination needed.

When too many posts in the blog, the index page becomes very very long.

article order in index.html page

Since Fix #12, the older articles are on the top of the page on the index.html, and the newer at the bottom.

I precise this problem doesn't appear on categories pages.

Make a better directory structure

Steve Howe and I discussed about separating a bit more the content folders, into different categories.

One proposition that could fit the needs is the following:

/content
/pages
/articles
/category1
/category2
/static
/images
/...
/pelican.conf.py

and then, while generating the output, change a bit that too:

/output (generated by pelican)
/static (a copy of the one in contents/static)
/theme
/theme1
css/main.css
...
/categories
/pages

...

fallback on mtime to detect date informations

If no informations about date is indicated, add a way to fallback using the mtime informations of a file to get it. (I'm thinking about deactivating such feature by default, but allowing to do so if wanted/needed)

"Attribute Error: 'Article' object has no attribute 'title' " when using Markdown entries

pelican raises an AttributeError when generating for Markdown entry files. Traceback for the error follows:

Traceback (most recent call last):
File "/usr/bin/pelican", line 3, in <module>
  main()
File 

"/usr/lib/python2.6/site-packages/pelican/__init__.py", line 137, in main
pelican.run()
File 

"/usr/lib/python2.6/site-packages/pelican/__init__.py", line 61, in run
 p.generate_context()
 File 

"/usr/lib/python2.6/site-packages/pelican/generators.py", line 192, in generate_context
  filename=f)
File 

"/usr/lib/python2.6/site-packages/pelican/contents.py", line 33, in __init__
  self.slug = slugify(self.title)
AttributeError: 

'Article' object has no attribute 'title'

Each .md file has a "Title" attribute.

Implement a better logging system

I find it hard to debug using the traces: the only one appearing are the stack traces or the "[ok] Writing ..."

If there was a selectable logging level, with more or less details on the pelican processus, it would be useful.

Licence and copyright information are missing

Hello,

There is a problem with the Pelican's license:
According to this page, «a copyright notice» and «a statement of copying permission» must be present in the header of all files of Pelican, like this:

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
#
#    Copyright (c) 20XX-2011   XXXXXX XXXXXXX
#
#    This file is part of Pelican.
#
#    Pelican is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    Pelican is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with Pelican.  If not, see <http://www.gnu.org/licenses/>. 
#

But this text is only present in the LICENSE file, instead of the complete license

Feature request : change locale for date formatting

Hi,

I've been working on a private blog, and there'll only be french-speaking persons reading it. I know I've got to translate static english strings into french from the templates, and I'm fine with that. But I've got issue with date formatting.

templates are using:

{{ article.date.strftime('%a %d %B %Y') }}

which should use locale for formatting. And then, all the dates are in English, like "Tue 25 January 2011". How would it be possible to display dates in french or whatever language I'd like, for a project (settings?) or event a specific page (if I've got translated pages, I surely need a translated date for this specific page...)

Unsorted categories

Hi,

At first, I thought categories were sorted by alphabetical order. But I've got a problem with a personal / private blog. I've assigned the year to the "Category" property of its articles, and as a result, the categories are sorted like this:

2009 2011 2010

How could I sort these in ascending or descending order?

Use of tags in templates

I try to use tags in themes, but when I make a {{ article.tags }} in the template, I receive something like [u'images']

Is it actually possible to have a list of tag links ?

Thanks

Update the documentation

Documentation is not really up to date. Seems there is a need to update it, and to put more informations about the settings, theme support and extending pelican, too. (moving away from a one-page-doc)

control deletion of the output directory with a commandline argument

hi,
it would be nice to control the deletion of the output directory with an additional commandline argument (eg. '-d'):

  • files that do not belong to the blog can stay in the same directory (wiki, temporary files, etc)
  • old files can simply be overwritten with the generated ones
  • default behaviour: deletion of the directory

what do you think? I can implement this with an appropriate update to the docs as well if it is ok to have such a feature…

ZeroDivisionError during generation

Hi,

After a fresh installation of pelican-main, I have an error during generatation of my first thread which has tags. :

[...] pelican/generators.py", line 243, in generate_context
for tag, count in tag_cloud
ZeroDivisionError: float division by zero

For determining the size font, pelican does a little trick with mathematics functions. :

(line 240)
math.floor(steps - (steps - 1) * math.log(count) / math.log(max_count))

But :

(line 233)
max_count = max(tags).

When you have a single article with tags, the max can only be 1, and log(1) == 0.0.

I hope that is clear to you.

Pygments support documentation

There should be at least one paragraph saying that when someone uses ".. code-block::" rst directive, he/she should insert the short or full name of the lexer as the first argument according to http://pygments.org/docs/lexers/. It's unclear for people unfamiliar with Sphinx/pelican/pygments.

Add an exemple about pages on the documentation

The documentation doesnt talk about pages, it could be useful to do so.
In the same time, it could be useful too to split the documentation into different pieces, not like it currently is (only one readme).

Running Pelican on /path/to/content/ gives categories nammed /path/to/content/foo, path/to/content/bar, etc...

Hello,

With the last GIT version of Pelican, building a blog located in /path/to/content/ gives categories nammed /path/to/content/foo, path/to/content/bar, etc...

Steps to reproduce the problem:

  1. Checkout and the install the last version of Pelican in the GIT repository
  2. Create a directory called «content».
  3. Create subdirectories in this directory
  4. Run pelican and open the generated file in your web browser

Here is a Bash session showing the problem:

[18:18:13] skami@skami-laptop:/tmp$ mkdir -p content/{cat1,cat2}
[18:18:45] skami@skami-laptop:/tmp$ echo -en 'Post 1\n#####\n\n...' >> content/cat1/post1.rst
[18:19:26] skami@skami-laptop:/tmp$ echo -en 'Post 2\n#####\n\n...' >> content/cat2/post2.rst
[18:19:39] skami@skami-laptop:/tmp$ tree content/
content/
├── cat1
│   └── post1.rst
└── cat2
    └── post2.rst

2 directories, 2 files
[18:19:44] skami@skami-laptop:/tmp$ pelican content/ -o output
 [ok] writing /tmp/output/feeds/all.atom.xml
 [ok] writing /tmp/output/feeds/content/cat1.atom.xml
 [ok] writing /tmp/output/feeds/content/cat2.atom.xml
 [ok] writing /tmp/output/feeds/all-en.atom.xml
 [ok] writing /tmp/output/post-2.html
 [ok] writing /tmp/output/post-1.html
 [ok] writing /tmp/output/index.html
 [ok] writing /tmp/output/tags.html
 [ok] writing /tmp/output/categories.html
 [ok] writing /tmp/output/archives.html
 [ok] writing /tmp/output/category/content/cat1.html
 [ok] writing /tmp/output/category/content/cat2.html
 [ok] copying /usr/local/lib/python2.6/dist-packages/pelican/themes/notmyidea/static to     /tmp/output/theme/.
[18:20:01] skami@skami-laptop:/tmp$ tree output/
output/
├── archives.html
├── categories.html
├── category
│   └── content
│       ├── cat1.html
│       └── cat2.html
├── feeds
│   ├── all.atom.xml
│   ├── all-en.atom.xml
│   └── content
│       ├── cat1.atom.xml
│       └── cat2.atom.xml
├── index.html
├── post-1.html
├── post-2.html
├── tags.html
└── theme
    ├── css
    │   ├── main.css
    │   ├── pygment.css
    │   ├── reset.css
    │   └── wide.css
    └── images
        └── icons
            ├── delicious.png
            ├── lastfm.png
            ├── linkedin.png
            ├── rss.png
            └── twitter.png

8 directories, 21 files
[18:20:21] skami@skami-laptop:/tmp$

Thanks for reading

Unicode issue with new date formatting option

I've got a problem, probably caused by a Unicode / ascii issue caused by the brand-new-shiny locale date formatting.

I guess, the "december" month becoming "Décembre" spits out the following message:

File "/home/bruno/Projets/[redacted]/pelican/pelican/themes/simple/templates/article.html", line 7, in block "content"
    {{ article.locale_date }}
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 9: ordinal not in range(128)

the chosen formatting is:

DEFAULT_DATE_FORMAT = u'%a %d %B %Y'

Article titles and translations

When making translations of article, the urls of the articles have the value of the slug instead of the title of the article.

So if we create a translation few days after, the original url is lost.

archives per year and year/month

Hi,
is there an easy way to generate archive pages per year and year/month?

This could be really useful for building linkable archive-sidebars like:

  • Dec 2010 (count) <-- link to archive/2010-12.html
  • Nov 2010 (count) <-- link to archive/2010-11.html

or:

  • 2010 (articles per year) <-- link to archive/2010.html
    • Dec (count) <-- link to archive/2010-12.html
    • Nov (count) <-- link to archive/2010-11.html

Translation link

I would like to translate some of my articles, but I didn't understood how to make the translation link

Suppose a french article "Mon premier article" and I would like to do the translation with an english article "My first post"

So I have created the premier_article.rst file with :lang: fr.
but if I do first_post.rst with :lang: en, how can Pelican understand that the article are translation of the other ?

I don't understand this point. If you could help me.

Thanks

rss2pelican

Use a rss feed to import the contents of a weblog to pelican. (with support of RST and Markdown, via pandoc)

Problem with accents in setting.py

Hello,

I had a problem when setting the blogroll with this line :
('Génération Linux', 'http://www.generation-linux.fr'),

I discovered than the problem comes from the accents of 'Génération Linux' and dissapears when I replace É by E.

I hadn't the # -- coding: utf-8 -- line, but the problem is the same with and without.

I receive this line of error about Unicode :
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)

Multilingual support for posts.

I propose to add a support for posts translation. For example, some posts in my russian blog, could have an english translation and I want to show a link to all available translations from the post written in default language.

We need a special meta field Lang and a setting option DEFAULT_LANG=en.

Then we'll need to stack posts with equal slugs and different Lang metafields together and crosslink them.

What do you think? I could try to implement this feature in my fork, and send you a patch.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.