Closed ghost closed 12 years ago
Hi,
I just add category-safe
property for a post. Thus It would be published into category-safe
instead of category
.
For the moment a tag is not connected to a category. Maybe in a future version this will be done.
RSS exporter use the function: (htmlize-protect-string(ob:post-content-html p))
You can thus change it and use your own. Be aware that you might break the html.
Do you have an example of your needs?
It might be possible by comparing the link path and the post output path.
I really wish there was an easy way to truncate the post for RSS export. I am surprised it can't be done easily. In Liquid, I only have to use "
{{post.content | strip_html | xml_escape | truncatewords: 60}}
", which makes sure the html isn't broken and truncates the words.
Thanks again!
Please check last commit (de5dc0d5cb7b3b1c231192f2b7064335b347bbae) that should fix the category issue.
If you do have a fix please send a pull request.
Yep that's why using a cl-structure ob:category
is a better idea that adding a category-safe
as I did before.
This is not liquid unfortunately. What does exactly "{{post.content | strip_html | xml_escape | truncatewords: 60}}"?
Maybe a piece of lisp can handle this.
Update: AFAICR the html is removed thus you get an unformated text right?
Almost! It fixes the previous issues and works well except for one thing that was working before but no longer works. I want to get the category name and link of a particular post on the tags index page, but that no longer works. I tried everything but get errors such as "Lisp error in nil: (error ob:post-category-safe accessing a non-ob:post)". The debug page now has "[cl-struct-ob:category "Volume 1 No. 1 (2012): May" "volume-1-no-1-2012-may"]" for the category. My current code is below:
<lisp>(ob:insert-template "page_header.html")</lisp>
<h2>Articles</h2>
<lisp>
(progn
(loop for post in POSTS
do (when (member (ob:tags-safe TAG) (mapcar 'ob:tags-safe (ob:post-tags post)))
(insert (format "
<section>
<h3><a href=\"%s/%s\" title=\"%s\">%s</a></h3>
<h4>%s</h4>
<p>%s <a href=\"%s/%s\" title=\"%s\">Read more →</a></p>
<p><cite><a href=\"%s/%s/index.html\">From <em>Luvah Number %s</em></a></cite></p>
" (ob:path-to-root) (ob:post-htmlfile post) (ob:post-title post) (ob:post-title post) (ob:post-author post) (ob:post-excerpt post) (ob:path-to-root) (ob:post-htmlfile post) (ob:post-title post) (ob:path-to-root) (ob:post-category-safe post) (ob:post-category-name post) )"</section>"))))
</lisp>
<lisp>(ob:insert-template "page_footer.html")</lisp>
I have a quick and dirty hack that works for top level menus. I will refine it and send a pull request if I can manage to get it working properly.
I can't say I understand this fully. Would you mind explaining how this will solve my issue? I am more used to PHP and Ruby, and an just getting started with Lisp, so please be patient and bear with my novice mistakes and possibly silly questions.
"{{post.content | strip_html | xml_escape | truncatewords: 60}}" simply removes all HTML tags, then processes what is left to make sure it is safe and valid XML, then finally truncates the text after 60 words. This works well for me since I prefer for my news feeds to contain teasers with plain text. The reader can then visit the site if they so desire. As you can see, my needs here are rather simple. Do you think some Lisp can work magic here?
I managed to get the categories on the tag page working by using the following:
(ob:category-safe (ob:post-category post)) (ob:category-name (ob:post-category post))
I am not sure if it is the best solution, but it works.
Yes this is the way to use categories.
I close this discussion. Please re-open one issue per topic.
Thanks
I apologize for the rambling thread. Thank you so much for all of your help!
Thank you for your work on o-blog. I am currently working on modifying o-blog to make it into a system capable of managing an online, open-access journal. I am currently using a combination of Org export and Jekyll, but discovered o-bog, which allowed me to create most of the functionality I needed. I do have a few things that I can't seem to get working. I would greatly appreciate your help with those few things. Since this will be a real-world application of o-blog, fixing these issues may be advantageous for others as well.
In Jekyll, I am using the following code, but can't seem to do something similar with o-blog:
Basically, what I am trying to do is limit posts to the current category / issue, say One for example and then go through all tags for articles in that issue and display first the tag, then the articles associated with that tag.
Ex:
{% assign activemenu = page.bodyclass %}