Coder Social home page Coder Social logo

getpelican / pelican-plugins Goto Github PK

View Code? Open in Web Editor NEW
1.4K 1.4K 856.0 3.37 MB

Collection of plugins for the Pelican static site generator

License: Other

Python 69.77% CSS 2.15% HTML 21.21% Smarty 0.50% Emacs Lisp 0.30% Shell 0.28% JavaScript 0.65% Jupyter Notebook 4.69% Haskell 0.30% Makefile 0.11% C 0.02% SCSS 0.03%

pelican-plugins's People

Contributors

alistairmagee avatar almet avatar aqw avatar arty-name avatar avaris avatar barrysteyn avatar cdunklau avatar cscutcher avatar davidlesieur avatar dflock avatar ingwinlu avatar jakevdp avatar jappeace avatar jar1karp avatar joergdietrich avatar justinmayer avatar kdeldycke avatar kernc avatar kylef avatar lucas-c avatar mothsart avatar pauloxnet avatar pxquim avatar renatolfc avatar rlaboiss avatar scheirle avatar smartass101 avatar talha131 avatar wilsonfreitas avatar xsteadfastx 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

pelican-plugins's Issues

Extract_toc inserts nothing when used with [TOC] in md-file

I want to insert a TOC into my generated pages, but the TOC is not inserted where I placed the [TOC] marker.

The plugin is activated, the MD_EXTENSIONS-variable is also set.

When debugging the problem with pudb I can see that content.toc is filled with the HTML-output:

>>>print content.toc
u'<div class="toc">\n<ul>\n<li><a href="#header-1">Header 1</a><ul>\n<li><a                                                    
href="#header-2">Header\xa02</a></li>\n</ul>\n</li>\n</ul>\n</div>'                                                            

But it does not get inserted. There's nothing in the DEBUG-log either.

Pelican-conf is here:
https://github.com/rndmh3ro/blog/blob/master/pelicanconf.py

Any hints?

Gravatar available outside article's context

Hello!

I'm just wondering if there's any reason why the author_gravatar template tag is only available to the article's context. I'm working on a single author blog, which would benefit from a gravatar tag available to the sidebar tag.

Thanks!

Unicode errors using bootstrap2 template and w3c_validate plugin

I'm really new to pelican, but I'm stuck trying to use the 3wc_validate plugin. If I omit the plugin everything works fine, however when I enable the plugin, I get the following error when running make html

-> writing /home/user/git/user/user.info/output/archives.html
-> writing /home/user/git/user/user.info/output/pages/about-me.html
-> Validating: /home/user/git/user/user.info/output/archives.html
CRITICAL: File name or file only. Got <type 'unicode'> instead
Traceback (most recent call last):
  File "/home/user/virtualenvs/pelican/bin/pelican", line 9, in <module>
    load_entry_point('pelican==3.2.2', 'console_scripts', 'pelican')()
  File "/home/user/virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/__init__.py", line 378, in main
    pelican.run()
  File "/home/user/virtualenvs/pelican/local/lib/python2.7/site-packages/pelican/__init__.py", line 183, in run
    signals.finalized.send(self)
  File "/home/user/virtualenvs/pelican/local/lib/python2.7/site-packages/blinker/base.py", line 267, in send
    for receiver in self.receivers_for(sender)]
  File "/home/user/git/user/user.info/pelican-plugins/w3c_validate/wc3_validate.py", line 25, in validate_files
    validate(filepath)
  File "/home/user/git/user/user.info/pelican-plugins/w3c_validate/wc3_validate.py", line 42, in validate
    vld.validate_file(filename)
  File "/home/user/virtualenvs/pelican/local/lib/python2.7/site-packages/py_w3c/validators/html/validator.py", line 67, in validate_file
    raise Exception("File name or file only. Got %s instead" % type(filename_or_file))
Exception: File name or file only. Got <type 'unicode'> instead
make: *** [/home/user/git/user/user.info/output/index.html] Error 1

There should be branches for each version of Pelican

We should have branches in this repository for each version of Pelican.

I'm just beginning to use Pelican and am importing the plugins from this repository, but the summary plugin gives the following error:

CRITICAL: cannot import name DEFAULT_CONFIG

...because of #33, which is for the next version of Pelican (I have 3.2).

Line breaks for eqnarray environment in LaTeX

I've been using the Pelican LaTeX plugin and it works great! Thanks!

I noticed that when I use the eqnarray environment in markdown, I have to use triple slashes "\" for linebreaks instead of "" Otherwise, it doesn't work. For example:

$$ \begin{eqnarray} \nabla \cdot \vec{E} &=& 4\pi\rho \\ \nabla \cdot \vec{B} &=& 0 \\ \nabla \times \vec{E} &=& -\frac{1}{c}\frac{\partial \vec{B}}{\partial t} \\ \nabla \times \vec{B} &=& \frac{1}{c}\left(4\pi\vec{J} + \frac{\partial \vec{E}}{\partial t}\right) \end{eqnarray} $$

If someone else can confirm this issue, can this detail be added to the documentation for the LaTeX plugin?

include_code tag in liquid_tags plugin output wrong "download" link

With the new change in pelican 3.3, there is no longer static directory. The include_code tag imports code just fine but gives the wrong "download" link.
E.g.: instead of http://localhost:8000/downloads/code/foo.py, the download link is: http://localhost:8000/static/downloads/code/foo.py

Other tags seem work well.

Error with ``liquid_tags`` plugin: No module named 'mdx_liquid_tags'

@jakevdp - I'm getting the following error with the liquid_tags plugin, have you seen this before? I'm using Python 3.3.

ERROR: Can't find plugin `liquid_tags.img`: No module named 'mdx_liquid_tags'
ERROR: Can't find plugin `liquid_tags.video`: No module named 'mdx_liquid_tags'
ERROR: Can't find plugin `liquid_tags.include_code`: No module named 'mdx_liquid_tags'
ERROR: Can't find plugin `liquid_tags.notebook`: No module named 'mdx_liquid_tags'
ERROR: Can't find plugin `liquid_tags.literal`: No module named 'mdx_liquid_tags'

liquid_tags plugin does not support {filename} syntax for linking to internal content.

Per http://blog.getpelican.com/pelican-3.3-released.html, the {filename} or |filename| keyword prepended to a file path should resolve to the internal content.

More details about linking to internal content can be found here : http://docs.getpelican.com/en/3.3.0/getting_started.html#ref-linking-to-internal-content

That being said, the following tag is not compatible with the regex used in the liquid_tags.video plugin. Other liquid_tags plugins may be effected, but I have not tested them.

{% video {filename}/images/videos/video_hq.mp4 {filename}/images/videos/video_lq.mp4 640 480 %}

It catches the first link but fails to catch the second video or the width and height.

In short, the regex is not compatible with the {filename} notation and fails to resolve the {filename} PATH accordingly.

For reference:

Sitemap requires date field

I have pages w/o Date: in the header. In this case the sitemap crashes now that I've upgrade to 3.4.0.

CRITICAL: expected string or buffer
Traceback (most recent call last):
  File "/Users/mankoff/Library/Enthought/Canopy_64bit/User/bin/pelican", line 9, in <module>
    load_entry_point('pelican==3.3', 'console_scripts', 'pelican')()
  File "/Users/mankoff/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pelican/__init__.py", line 419, in main
    pelican.run()
  File "/Users/mankoff/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pelican/__init__.py", line 173, in run
    p.generate_output(writer)
  File "/Users/mankoff/projects/www/kenmankoff.com/plugin/sitemap/sitemap.py", line 186, in generate_output
    self.set_url_wrappers_modification_date(self.context['categories'])
  File "/Users/mankoff/projects/www/kenmankoff.com/plugin/sitemap/sitemap.py", line 171, in set_url_wrappers_modification_date
    modified = self.get_date_modified(article, datetime.min);
  File "/Users/mankoff/projects/www/kenmankoff.com/plugin/sitemap/sitemap.py", line 161, in get_date_modified
    return get_date(getattr(page, 'modified'))
  File "/Users/mankoff/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/pelican/utils.py", line 206, in get_date
    string = re.sub(' +', ' ', string)
  File "/Users/mankoff/local/Applications/Canopy.app/appdata/canopy-1.4.0.1938.macosx-x86_64/Canopy.app/Contents/lib/python2.7/re.py", line 151, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or buffer

Originally reported at: getpelican/pelican#1389

Adding TEMPLATE_PAGES to tipue search plugin

I have some HTML files in TEMPLATE_PAGES that I want to search with the tipue_search plugin.

These are HTML files with Jinja2 directives in them. It's longer content which is worth having in the search for my site. Example:

# Template pages - static pages that use Jinja - relative from content
TEMPLATE_PAGES = {'pages/resources/vim.html': 'resources/vim.html'}

Tipue_search.py iterates through a list of Articles and Pages to decide what to include in the JSON file.

It felt like I should have just been able to append the TEMPLATE_PAGES list on the end of the existing list in create_json_node() but I couldn't figure out how to easily add to this.

I've landed up pulling in the TEMPLATE_PAGES in tipue_search.py and creating a new function to set the JSON elements for these HTML pages. The new create_tpage_node() seems to work correctly.

Improve tests and testing environment

Testing plugins is a pain, and it shouldn't be.

I suggest we use tox, set up with the same environments as the main pelican repo. However, we shouldn't test against pelican/master, the tests should be against the latest version published on PyPI.

@ametaireau @justinmayer @avaris Thoughts?

webassets plugin filter 'gzip' not working

The assets plugin documentation suggests that it's possible to use gzip compression with the 'gzip' filter in the main README. When I try this, it fails every time. I also can't seem to find a gzip filter in the official webassets project.

I suggest we either get gzip in there, or remove it from the readme :)

doc for neighbors

The example for neighbors has a small bug. The last conditional should check for
article.next_article_in_category instead of article.next_article

render_math multiline equations

Hi, I want to use render_math to render multiline equation, because of my equation is too long.
But, I use follow code only generate online ugly equation.

$$\begin{align} f(x) & = (a+b)^2 \\ & = a^2+2ab+b^2 \\ \end{align}$$

[static_comments] One markdown file per comment

With the patch below, now every comment is in it's one markdown file. Because if all comments are in one file, it is hard to style them.

Changes:

  • One Comment per file
  • Slug folder instead of file
  • All meta information of these files are public to the theme.
  • Use native pelican markdown reader

Here is an example: blog.scheirle.de

Patch:

diff --git a/static_comments/static_comments.py b/static_comments/static_comments.py
index 65c4491..511841b 100644
--- a/static_comments/static_comments.py
+++ b/static_comments/static_comments.py
@@ -1,13 +1,13 @@
# -*- coding: utf-8 -*-

-import codecs
import logging
-import markdown
import os

logger = logging.getLogger(__name__)

from pelican import signals
+from pelican.utils import strftime
+from pelican.readers import MarkdownReader


def initialized(pelican):
@@ -23,23 +23,30 @@ def add_static_comments(gen, metadata):
    if gen.settings['STATIC_COMMENTS'] != True:
        return

+    metadata['static_comments_count'] = 0
+
    if not 'slug' in metadata:
-        logger.warning("static_comments: "
-                "cant't locate comments file without slug tag in the article")
+        logger.warning("static_comments: cant't locate comments file without slug tag in the article")
        return

-    fname = os.path.join(gen.settings['STATIC_COMMENTS_DIR'],
-            metadata['slug'] + ".md")
+    reader = MarkdownReader(gen.settings)
+    comments = []
+    folder = os.path.join(gen.settings['STATIC_COMMENTS_DIR'], metadata['slug'])

-    if not os.path.exists(fname):
+    if not os.path.isdir(folder):
+        logger.debug("No comments found for: " + metadata['slug'])
        return

-    input_file = codecs.open(fname, mode="r", encoding="utf-8")
-    text = input_file.read()
-    html = markdown.markdown(text)
-
-    metadata['static_comments'] = html
+    for file in os.listdir(folder):
+        name, extension = os.path.splitext(file)
+        if extension[1:].lower() in reader.file_extensions:
+            content, meta = reader.read(folder + "/" + file)
+            meta['locale_date'] = strftime(meta['date'], gen.settings['DEFAULT_DATE_FORMAT'])
+            comments.append((content, meta, name))

+    comments = sorted(comments, key = lambda comment : comment[1]['date'])
+    metadata['static_comments_count'] = len(comments)
+    metadata['static_comments'] = comments

def register():
    signals.initialized.connect(initialized)

New plugin: ViewerJS to open ODF and PDF directly in the browser

People often put documents and slides in PDF and ODF on their websites and it’d be really cool if Pelican would have a plugin where visitors could just open the document in the browser or even the blog writer could embed the document into the blog post itself.

Luckily, there are WebODF and PDF.JS that do exactly that and they’re both packaged into one neat script called ViewerJS!

All that would need to be done is to include ViewerJS as a plugin and that would take care of the magic! πŸ‘―

The instructions seem to be pretty easy – basically we’d just need modify the links to prepend "/ViewerJS/#.. in the href field.

Embedding the documents though, is just a bit more tricky and I haven’t the foggiest (yet) how to deal with iframe and in Pelican.

Sumary don't working

Hi. I'm using default installation of pelican(3.3).
Installing pelican plugins in "plugins" dir.
Added absolute path for greater reliability/.

  PLUGIN_PATH = '/home/bkmz/Dev/web/pelican/app/plugins'
  PLUGINS = ['summary', ]

After that I creating test article:

Π’Π•Π‘Π’ TEST test
#######################
:date: 2014-01-01 20:07
:author: admin
:slug: test-slug

Hello world!

.. raw:: html

    <!-- PELICAN_END_SUMMARY -->

After summary tag

Add some debug print in plugin, to check that it can find end marker:

diff --git a/summary/summary.py b/summary/summary.py
index fd9dfc1..0f19d8b 100644
--- a/summary/summary.py
+++ b/summary/summary.py
@@ -55,6 +55,7 @@ def content_object_init(instance):
                             if begin_summary != -1 else 0)
             end_summary = end_summary if end_summary != -1 else None
             instance._summary = instance._update_content(content[begin_summary:end_summary], instance._context.get('localsiteurl', ''))
+            print "UPDATED SUMMARY"

 def register():
     signals.initialized.connect(initialized)

And after that i get this in index.html

<article>
                    <h1 class="entry-title"><a href="/test-slug.html">Π’Π•Π‘Π’ TEST test</a></h1>
<footer class="post-info">
        <abbr class="published" title="2014-01-01T20:07:00">
                Wed 01 January 2014
        </abbr>

        <address class="vcard author">
                By <a class="url fn" href="/author/admin.html">admin</a>
        </address>
<p>In <a href="/category/misc.html">misc</a>. </p>

</footer><!-- /.post-info --><p>Hello world!</p>
<p>After summary tag</p>
                </article>

Or any other pages.

How I can get cuted text, before end marker?

liquid_tags: No syntax highlighting with IPython 2.0

Following the PR #175 I upgraded to IPython 2.0. My Python code cells have no syntax highlighting anymore (on current pelican-plugins master, pelican 3.3.0. jinja2 2.7.2). Downgrading to IPython 1.2.1 brings the syntax highlighting back.

[i18n_subsites] Missing cross subsite links

Scenario:

I want to link from page A to the same page A on a different subsite. The page A doesn't have to be an article where translations could be available (like tag, categories, author, ... pages).

Current limitation

I know that extra_siteurls.items() already contains the site url for the different subsites, but that is not sufficient because the path of a file could be different on the subsites.

So something like

{% for lang, url in extra_siteurls.items() %}
    <a href="{{ url }}/{{ output_file }}">{{ lang }}</a>
{% endfor %}

would only work if output_file would be the same on every subsite. But since you can change the *_URL for each subsite, this is not the case (You don't even have to change *_URL since changing the locale can have the same effect.).

Conclusion

Considering all this, it would be nice to have a list (of tuples (lang, url)) containing urls which point to the same article/page/... but on a different subsite, available in the theme.

@smartass101 do you know an easy way to implement this?

render_math doesn't work with markdown code syntax

When I compile markdown files containing markdown code syntax (enclosed by ...), then it returns "list indices must be integers, not float". Howerver, when I disabled render_math, Pelican works fine.

Related plugin title and url method: wrong or no output

When i write in my article.html template

<ul style="float:right">
{% for related_post in article.related_posts %}
<li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li>
{% endfor %}
</ul>

I get as as result :Β 

<ul style="float:right">
<li><a href="http://politiquedunetz.sploing.be/"><built-in method title of unicode object at 0xa612dd0></a></li>
<li><a href="http://politiquedunetz.sploing.be/"><built-in method title of unicode object at 0xa612710></a></li>
<li><a href="http://politiquedunetz.sploing.be/"><built-in method title of unicode object at 0xa612890></a></li>
<li><a href="http://politiquedunetz.sploing.be/"><built-in method title of unicode object at 0xa612788></a></li>
<li><a href="http://politiquedunetz.sploing.be/"><built-in method title of unicode object at 0xa612770></a></li>
<li><a href="http://politiquedunetz.sploing.be/"><built-in method title of unicode object at 0xa612800></a></li>
<li><a href="http://politiquedunetz.sploing.be/"><built-in method title of unicode object at 0xa612590></a></li>
</ul>

My plugins are PLUGINS = ['gzip_cache','sitemap',"neighbors", "post_stats", "related_posts"]

Thanks for the answer !

pdf plugin: required configuration elements are not documented.

When attempting to use this plugin I received:

CRITICAL: u'PDF_STYLE'
CRITICAL: u'PDF_STYLE_PATH'

A quick glance at https://github.com/getpelican/pelican-plugins/blob/master/pdf/pdf.py#L27-L28 would suggest these are required configuration settings, however I have no clue what they are (nor are they mentioned in the documentation). I updated my configuration and supplied an empty string for both.

which led to:

WARNING: Can't find stylesheet 
CRITICAL: format not resolved |filename|mydoc.rst

The documentation should indicate that those values are required,and suggest some values.

As for the format not resolve, the test file would seem to indicate this is a known issue: https://github.com/getpelican/pelican-plugins/blob/master/pdf/test_pdf.py#L33

Maybe call that out in the documentation as well?

read_more_link malformed images URLs in summary and broken read more links

@VuongN's new plugin renders summary in a way that while serving the content on localhost with make serve, images in the summaries are linked to the blog URL.

Disabling read_more fixes this. This issue is impacting creating posts which are not uploaded to the web yet since in the summary, images linked to a URL which does not exist, yet.

How to use code_include with Markdown?

The code_include plugin is only for reStructuredText, is there any alternative work with Markdown?

It seems that Pelican like reStructredText much more than Markdown.

[i18n_subsites] STATIC_PATHS copied multiple times

All files and folders in the STATIC_PATHS variable are copied in each subsite.

This is a huge problem if you have large files in it.

It would be better to just copy it once, but therefore correct the links in the subsites.

assets plugin with cssmin filter does not generate concatenated minified css

https://github.com/fly/burrito/blob/master/templates/base.html#L25-L27

generated html:

        <link rel="stylesheet" href="./theme/css/style.css">
        <link rel="stylesheet" href="./theme/css/pygments.css">

output of pip3.3 freeze -l:

Jinja2==2.7.2
Markdown==2.3.1
MarkupSafe==0.18
Pillow==2.3.0
Pygments==1.6
Unidecode==0.04.14
blinker==1.3
cssmin==0.2.0
docutils==0.11
feedgenerator==1.7
feedparser==5.1.3
pelican==3.3
pytz==2013.9
six==1.5.2
webassets==0.9

WEBASSETS=True in pelicanconf.py, as well as 'assets' set in plugin array.

[i18n_subsites] Move the default language output also in a subfolder (like a subsite)

It would be nice to have an option to move the generated files for the default language also in a sub folder, and treat it like a subsite.

So instead of this: (tree view output folder)
β”œβ”€β”€ author
β”œβ”€β”€ de
β”‚ β”œβ”€β”€ author
β”‚ β”œβ”€β”€ feeds
β”‚ β”œβ”€β”€ ....
β”œβ”€β”€ feeds
β”œβ”€β”€ ....

You would get this: (tree view output folder)
β”œβ”€β”€ de
β”‚ β”œβ”€β”€ author
β”‚ β”œβ”€β”€ feeds
β”‚ β”œβ”€β”€ ....
β”œβ”€β”€ en
β”‚ β”œβ”€β”€ author
β”‚ β”œβ”€β”€ feeds
β”‚ β”œβ”€β”€ ....

Assuming en is the default language and de a subsite.

With the patch below this is possible:
pelicanconf.py:

OUTPUT_PATH = 'output/en'
I18N_SUBSITES = {
'de': { 'OUTPUT_PATH' : 'output/de' }
}

Patch:

diff --git a/i18n_subsites/i18n_subsites.py b/i18n_subsites/i18n_subsites.py
index 2ae30e7..5bcdea0 100644
--- a/i18n_subsites/i18n_subsites.py
+++ b/i18n_subsites/i18n_subsites.py
@@ -67,7 +67,8 @@ def create_lang_subsites(pelican_obj):
         settings = orig_settings.copy()
         settings.update(overrides)
         settings['SITEURL'] = _lang_siteurls[lang]
-        settings['OUTPUT_PATH'] = os.path.join(orig_settings['OUTPUT_PATH'], lang, '')
+        if (not overrides.has_key('OUTPUT_PATH')):
+            settings['OUTPUT_PATH'] = os.path.join(orig_settings['OUTPUT_PATH'], lang, '')
         settings['DEFAULT_LANG'] = lang   # to change what is perceived as translations
         settings['DELETE_OUTPUT_DIRECTORY'] = False  # prevent deletion of previous runs
         settings = configure_settings(settings)      # to set LOCALE, etc.

Note: If you are using the makefile to build your site, you have to remove the -o option.

tipue_search and unicode

tipue_search plugin not support unicode in resulting json and replace unicode symbols as \xHH. For me solution is a add ensure_ascii=False in json.dump.

Jamendo plugin

It would be awesome to have a plugin for embedding Jamendo albums and playlists in the same way as we have for Vimeo and Youtube already.

Have a catalog of all the plugins

Sublime text, for instance, maintains a simple json file hosted somewhere remotely and there is a little command line to list / install the plugins. I suppose we could do this.

It means that each plugin should have a setup.py and proper packaging, but that would also enable people to not depend on this pelican-plugins repository.

Thoughts?

Images not correctly linked when using summary plugin

Using the reference-style image format (Markdown) with the summary plugin causes problems in linking to images in articles. If the image is found before the SUMMARY_END_MARKER, but the image information is found afterwards, the link is broken:

Example (^^ added because code wasn't rendering properly):

[![image][]][postcards]
Here is some text...

<!--SUMMARY_END_MARKER-->
Some more text...

^^[image]: |filename|/images/postcards-300x135.png
^^[postcards]: |filename|/images/postcards.png

Sitemap generation issue with disabled pages

With #203, it became impossible to generate a sitemap with disabled pages. For instance, if you want to disable all category pages, you put CATEGORY_SAVE_AS = False into pelicanconf.py and then, they get disabled. But with the changes in #203, it just fails with CRITICAL: 'bool' object has no attribute 'startswith'.

The reason is simple, it happens here: https://github.com/getpelican/pelican-plugins/blob/master/sitemap/sitemap.py#L131 since we try to concatenate a string value with a boolean one.

A quick fix would be to add the following lines before the concatenation:

if isinstance(page.save_as, bool) and not page.save_as:
    return

But I am not sure this is the right way to do it.

I also made a small repository here: https://github.com/xavierdutreilh/pelican-sitemap-issue if you need to reproduce the bug.

Sitemap fails to generate links to articles with a custom ARTICLE_URL

There appears to be an issue with sitemap generation when using a custom ARTICLE_URL similar to:

ARTICLE_URL = '{category}/{slug}'

The sitemap plugin just completely misses articles in the final output. However, the following construct works just fine.

ARTICLE_URL = '{category}/{slug}.html'

For some reason, the omission of the '.html' from the article URL causes Sitemap to miss articles in it's final output. Indexes, categories, and tags appear to generate fine, but articles are missing.

liquid notebook doesn't use pelican_loader

notebook.py has a variable pelican_loader which tries to modify the jinja2 template as an extra_loader passed to the HTMLExporter(). It turns out this extra_loader is not used at any stage. The modifications to the <pre> tags all come from the custom_highlighter. I realized this trying to modify the template by adding more blocks to the pelican_loader dict.

tipue_search: Error if TEMPLATE_PAGES=None

Default value of TEMPLATE_PAGES is None:

self.tpages = settings.get('TEMPLATE_PAGES')

for srclink in self.tpages:
    self.create_tpage_node(srclink)

iteration over self.tpages with None value will cause an error CRITICAL: 'NoneType' object is not iterable

Mixed content warnings under https

The youtube plugin has hard-coded

src='http://www.youtube.com/embed/{youtube_id}'

on line 43. Due to the http:// part, a warning is generated by the browser when the pelican site is deployed under https://; for some browsers, like google chrome, the youtube iframe stay blank, because the browser will not load non-https content.

A simple way to fix this is to replace the 'http://' with '//'. This is known as 'protocol relative url' [see for example http://billpatrianakos.me/blog/2013/04/18/protocol-relative-urls/ ] and the browser will then automatically load the youtube iframe over https:// or http:// depending on how the page is loaded.

The relevant part of line 43 would then be

src='//www.youtube.com/embed/{youtube_id}'

Related posts "article is undefined" when invoked in base.html

I am trying to use the related_posts plugin.
When i add the code at bottom to article.html, everything works fine, i get the related posts. But when i add it to base.html (to the sidebar), i get

jinja2.exceptions.UndefinedError: 'article' is undefined

when i do make html or make regenerate, although the site seems to be generated fine. Why is this happening and how can i fix this?

        {% if article.related_posts %}
            <ul class="side-nav">
            {% for related_post in article.related_posts %}
                <li><a href="{{ SITEURL }}/{{ related_post.url }}">{{ related_post.title }}</a></li>
            {% endfor %}
            </ul>
        {% endif %} 

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.