eudicots / Cactus

Static site generator for designers. Uses Python and Django templates.
BSD 3-Clause "New" or "Revised" License
3.47k stars 313 forks source link

up to date blog example? #157

Closed elguavas closed 8 years ago

elguavas commented 9 years ago

hi, just evaluating cactus and seems it could be just what i was looking for.

is there an up to date example of using the blog plugin anywhere, one that uses the new/current templates and plays well with having "prettify" turned on in config.json??

thanks.

krallin commented 9 years ago

Hey there,

I'm not sure I fully understand what your request is, mind clarifying your thoughts a bit?

Thanks!

elguavas commented 9 years ago

thanks for the reply. by now i've already created a modified blog.py plugin and supporting templates that behave just as i want.

i was talking about koenbok/CactusBlog on github, which was the only example of using blog.py to actually create a blog i could find. it's very out of date and uses deprecated cactus functionality and non cactus 3 standard templates.

i get the impression that a lot of the documentation for cactus is about, or in, the "cactus for mac" product. some good documentation for using the framework directly would be great, but i fully understand the time constraints of libre software developers. anyway i'm starting to get a handle on some stuff now just from poking around in the code. thanks.

elguavas commented 9 years ago

oh, btw one change i made from blog .py in my own simple blog plugin was in the the section where a page context is built for each post. the line:

            postContext['path'] = page.path

does not give a useful page path for using with the {% url ... %} template tag, because it lacks the leading '/', so i added an extra line to the context:

postContext['abspath'] = '/' + page.path  # smg - prepend '/' for use by {% url ... %}

and i then use 'abspath' in the {% url ... %} in the blog page template instead of 'path'.

blattms commented 8 years ago

@elguavas I created a PR that uses page.absolute_path instead (but for other reasons...), see #229. Does that solve your problem, too?

antown commented 8 years ago

@blattms Any solution with prettified paths?

blattms commented 8 years ago

@offbase-prod I am not sure I get your question. My PR is to use prettified paths, see http://www.dr-blatt.de/blog. You only need to set "prettify": true in config.json

antown commented 8 years ago

@blattms Having prettify set to 'true' {{ post.path }} retuns link "abc/def.html" on archive page, for example. Is there are any way to make link looks like "abc/def/"?

blattms commented 8 years ago

@offbase-prod That is exactly what #229 is about. The blog list on my site is

<div class="text-content">
  <ul>
      {% for post in posts %}
      <li>
        <h2><a href="{% url post.path %}" class="post-list-item">{{ post.title }}</a></h2>
        <small>by {{ post.author }} at {{ post.date|date:"F j, Y" }}</small><br />
        {{ post.body|truncatewords_html:30}}
      </li>
      {% endfor %}
  </ul>
</div>

Unfortunately, it is not merged yet. Therefore you need to have apply some git foo:

git add remote blattms https://github.com/blattms/Cactus
git fetch blattms
git checkout blattms/prettify-urls-in-post-context

to test it.

antown commented 8 years ago

@blattms Got it, thank you!

elguavas commented 8 years ago

seems to be solved. thnx blattms.

blattms commented 8 years ago

It might be solved, but as the PR is not yet merged I wouldn't call it fixed. You might want to reopen to get some attention to this