Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Can I show latest blog posts in a block on the home page?

By
David Vandervoort
on 5/18/16, 4:02 PM 441 views

I would like to display the latest 3 blog posts in a block on the home page, just the title and tagline in more or less the same way as on the blog overview page. Can it be done? If so, how? 


1

Ermin Trevisan

--Ermin Trevisan--
3524
| 6 3 7
Walchwil, Switzerland
--Ermin Trevisan--


Ermin Trevisan
On 5/19/16, 12:29 AM

There is a "latest blog post" website builder snippet in most of Odoo's website builder themes which displays the 3 latest posts.

Thanks Ermin, but it seems that it is not available in the theme I am using. Also should have mentioned in my question that I'm on version 8 probably.

D4D, David Vandervoort
on 5/19/16, 1:20 AM

There is no difference between 9.0 and 8.0 concerning this. Which theme are you using?

Ermin Trevisan
on 5/19/16, 1:23 AM

Cerulean at the moment, but also tried others, it doesn't seem to be in there

D4D, David Vandervoort
on 5/19/16, 2:56 AM

Ah, the free bootsstrap themes only contain a few basic snippets. If you use one of the paid themes, you get about 90 building blocks/snippets included (check the theme description).

Ermin Trevisan
on 5/19/16, 3:38 AM

Thanks Ermin, any theme you would recommend / have experience with?

D4D, David Vandervoort
on 5/20/16, 1:50 PM

As a 50-Themes-Pack-Supporter of the Indiegogo campaign I have experience with a lot of themes (https://www.indiegogo.com/projects/bootstrap-themes-for-odoo-cms#/). You should select your theme according to the looks and the list of building blocks it offers. Check all themes in the app store, look at the building blocks they offer and thoroughly look at the live preview. If you know what you would like, ask me before to check it (obviously there are mistakes in the themes descriptions, for example theme KEA does have the latest post building block, but you won't find it in the description).

Ermin Trevisan
on 5/20/16, 3:26 PM

Theme "Louma" looks very promising, so far it seems to be the only one that offers a sidebar menu in their description. However, they don't have a latest posts widget. Do you any theme that has both?

D4D, David Vandervoort
on 5/24/16, 3:13 AM

I can not say anything about non-Odoo themes. Avantgarde is an Odoo theme, that offers a hamburger navigation button with the menu on the right side bar and has the latest posts building block.

Ermin Trevisan
on 5/24/16, 4:09 AM

By the way, I believe that my help so far is well worth an upvote! :-)

Ermin Trevisan
on 5/24/16, 4:12 AM

It sure is Ermin! I was just too pre-occupied with my own stuff, sorry for that and many thanks for the great help!

D4D, David Vandervoort
on 5/24/16, 9:29 AM

:-) thanks

Ermin Trevisan
on 5/24/16, 10:00 AM
0
Silvestar j
On 8/19/16, 2:44 AM

from openerp import http

class BlogPosts(http.Controller):

    @http.route(['/page/homepage'], type='http', auth="public", website=True)

    def blog_posts(self, **kwargs):

            post = http.request.env['blog.post'].search([])

            values = {

                'post_ids' : post,

             }

           return request.website.render("website_posts.index", values)




This is xml Template View

-----------------------------------------

<template id="index" inherit_id="website.homepage" name="Homepage">

<xpath expr="//div[@id='wrap']" position="inside">


<div class="row">

<div class="col-xs-12">

<div class="news_list">

<div t-foreach="post_ids" t-as="news">

<a t-field="news.name" t-attf-href="/blog/#{ slug(news.blog_id) }/post/#{slug(news) }"

style="text-align:left;font-size:16px;font-color:#fff;text-decoration:

none;"

class="new_title">

<t t-if="not news.name" style="text-align:left;">Untitled

Post

</t>

</a>

<div class="news_name">

<div name='blog_post_data'>

<span t-field="news.author_id" style="display: inline-block;"

t-field-options='{

"widget": "contact", "fields": ["name"] }' />

<i class="fa fa-clock-o"></i>

<span t-field="news.create_date"

t-field-options='{"format": "dd MMMM yyyy

HH:MM"}' />

<span t-if="not news.website_published" class="label label-danger">not

published

</span>

</div>

</div>

<div class="oe_structure" />

</div>

</div>

</div>

</div>

<div class="oe_structure" />





</xpath>

</template>



Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 5/18/16, 4:02 PM
Seen: 441 times
Last updated: 8/19/16, 2:44 AM