renard / o-blog

Standalone orgmode blog exporter. DEPECATED, NOT MAINTAINED
http://renard.github.com/o-blog-v2
260 stars 58 forks source link

Errant behavior with latest posts on category index #40

Closed ghost closed 12 years ago

ghost commented 12 years ago

I currently have code in page_footer.html that adds a sidebar to every page. As part of that sidebar is a listing of the 12 most recent articles. This works very well, except when you visit a category index page. Instead of showing the most recent articles for the entire site, the most recent articles from that category are shown. Is there a way to get this to show the most recent articles for the entire site (all categories) even on a category index page?

Here is the code in question:

<h4>Current Issue</h4>
<ul>
<lisp>
  (loop for p in (ob:get-posts nil 12)
  do (insert (format "<li><a href=\"%s/%s\">%s</a></li> "
  (ob:path-to-root)
  (ob:post-htmlfile p)
  (ob:post-title p)
  )))
</lisp>
</ul>
renard commented 12 years ago

Hi,

You might try using

<h4>Current Issue</h4>
<ul>
<lisp>
  (loop for p in (let ((POSTS POSTS-ALL) ) (ob:get-posts nil 12))
  do (insert (format "<li><a href=\"%s/%s\">%s</a></li> "
  (ob:path-to-root)
  (ob:post-htmlfile p)
  (ob:post-title p)
  )))
</lisp>
</ul>

The problem is that POSTS is changed to match only articles from a given category for its index.

That's what POSTS-ALL is meant for.

ghost commented 12 years ago

I just tried this suggestion and get "Lisp error in nil: (void-variable POSTS-ALL)". I grepped the entirety of o-blog and don't see the variable "POSTS-ALL" being defined anywhere. Can you give me a heads up on how to define this so that I can get it working?

ghost commented 12 years ago

OK, nevermind. It works now, once I realized it should be "ALL-POSTS" not "POSTS-ALL". Thank you for your help!

renard commented 12 years ago

Content preview: Farasha Euker reply@reply.github.com writes: > OK, nevermind. It works now, once I realized it should be "ALL-POSTS" not "POSTS-ALL". Thank you for your help! [...]

Content analysis details: (-2.9 points, 5.0 required)

pts rule name description


-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000]

Farasha Euker reply@reply.github.com writes:

OK, nevermind. It works now, once I realized it should be "ALL-POSTS" not "POSTS-ALL". Thank you for your help!

Oups sorry for the typo, it was late on night  :-).

Sébastien Gross