Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: sourcelink & pretty urls #474

Closed
icaroperseo opened this issue Apr 25, 2013 · 1 comment
Closed

Bug: sourcelink & pretty urls #474

icaroperseo opened this issue Apr 25, 2013 · 1 comment
Assignees

Comments

@icaroperseo
Copy link

Playing a little bit with the settings Nikola I have found an error in the creation of the sourcelink when establishing the options:

conf.py:

    STRIP_INDEXES = True
    ...
    PRETTY_URLS = True

These options create within the output/posts folder a set of folders that taking by name the title of each post and whose content are index.html and index.* files. This means that if you have a post titled foo on your website (http://www.example.com), the link provided by Nikola for sourcelink would be:

    http://www.example.com/posts/foo/foo.txt

obtaining a 404 error because within output/posts/foo folder only exist index.html and index.txt files.

This is the code inside the post template

post.tmpl:

    <%block name="sourcelink">
    % if not post.meta('password'):
        <li>
        <a href="${post.meta('slug')+post.source_ext()}" id="sourcelink">${messages("Source")}</a>
        </li>
    % endif
    </%block>

The above code works perfectly when the PRETTY_URLS option is not enabled, but once it set to True logically the error appears. For now I've solved it substituting:

    <a href="${post.meta('slug')+post.source_ext()}" id="sourcelink">${messages("Source")}</a>

with:

    <a href="index${post.source_ext()}" id="sourcelink">${messages("Source")}</a>

Obviously is not the perfect and final solution but for now it works for me XD.

@ghost ghost assigned ralsina Apr 26, 2013
@ralsina
Copy link
Member

ralsina commented Apr 26, 2013

Yes, the real solution is slightly more complicated, as it was to be expected :-)

I'll have it ready in a little bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants