You are doing it in the base template which is used by every page, and not
all have a post, you should do it in the specific template you are using
for your page. Please check the example given here:
https://getnikola.com/creating-a-custom-page.html

On Thu, Oct 15, 2020 at 2:19 AM J K <[email protected]> wrote:

> I tried the following but still got an error
>
> *base.tmpl*
> ```
> % if post.meta("landingpage")!="True":
> <div class="container" id="content" role="main">
> <div class="body-content">
> % endif
> ```
> *index.html*
> ```
> <head>
>     <title>Home</title>
>     <meta name="hidetitle" content="True" />
>     <meta name="landingpage" content="True" />
> </head>
> ```
>
> *Error:*
> ```
>   File "C:\Users\kk\PortableApps\git\home\repos\allika\web\cache\.mako.tmp\
> base.tmpl.py", line 133, in render_body
>     if post.meta("landingpage")!="True":
> AttributeError: 'Undefined' object has no attribute 'meta'
> ```
> I then tried the following combinations but got the same error for all.
> post.meta("hidetitle")!="True"
> page.meta("hidetitle")!="True"
> post.meta("title")!="Home"
> page.meta("title")!="Home"
>
> Please advise. I hope there is a way to pass a page meta tag to the
> template. I want to pass some kind of page identifier so that I can change
> the format for that page in the base.tmpl.
>
> On Monday, October 12, 2020 at 2:37:31 PM UTC+5:30 Roberto Alsina wrote:
>
>> I think you should just use post.meta(keyname) instead of page.meta
>>
>>
>>
>> On Mon, Oct 12, 2020 at 6:01 AM J K <[email protected]> wrote:
>>
>>> Kindly advise how to pass a meta value of a page to a template. Sorry to
>>> repost, but I am stuck here and could use some help. Here is the code I
>>> modified.
>>>
>>> ```
>>> % if page.meta("landingpage")!="True":
>>> <div class="container" id="content" role="main">
>>> <div class="body-content">
>>> % endif
>>> <!--Body content-->
>>> ${template_hooks['page_header']()}
>>> <%block name="extra_header"></%block>
>>> <%block name="content"></%block>
>>> <!--End of body content-->
>>> % if page.meta("landingpage")=="True":
>>> <div class="container" id="content" role="main">
>>> <div class="body-content">
>>> % endif
>>> <footer id="footer">
>>> ${content_footer}
>>> ${template_hooks['page_footer']()}
>>> <%block name="extra_footer"></%block>
>>> </footer>
>>> </div>
>>> </div>
>>> ```
>>>
>>> I also added the following to the head section of my landing page:
>>>
>>> `<meta name="landingpage" content="True" />`
>>>
>>> But I get the following error when I build the site:
>>>
>>> ```
>>> if page.meta("landingpage")!="True":
>>> AttributeError: 'Undefined' object has no attribute 'meta'
>>> ```
>>>
>>> On Monday, October 5, 2020 at 1:45:21 AM UTC+5:30 J K wrote:
>>>
>>>> I understood that if I pulled the "Body content" of the container in
>>>> base.tmpl, the page expands almost as desired. But, the problem is, it
>>>> changes all pages instead of just one. So, I am trying to add an "if"
>>>> condition like this:
>>>>
>>>> ```
>>>> % if page.meta("landingpage")!="True":
>>>> <div class="container" id="content" role="main">
>>>> <div class="body-content">
>>>> % endif
>>>> <!--Body content-->
>>>> ${template_hooks['page_header']()}
>>>> <%block name="extra_header"></%block>
>>>> <%block name="content"></%block>
>>>> <!--End of body content-->
>>>> % if page.meta("landingpage")=="True":
>>>> <div class="container" id="content" role="main">
>>>> <div class="body-content">
>>>> % endif
>>>> <footer id="footer">
>>>> ${content_footer}
>>>> ${template_hooks['page_footer']()}
>>>> <%block name="extra_footer"></%block>
>>>> </footer>
>>>> </div>
>>>> </div>
>>>> ```
>>>>
>>>> I also added the following to the head section of my landing page:
>>>>
>>>> `<meta name="landingpage" content="True" />`
>>>>
>>>> But I get the following error when I build the site:
>>>>
>>>> ```
>>>> if page.meta("landingpage")!="True":
>>>> AttributeError: 'Undefined' object has no attribute 'meta'
>>>> ```
>>>>
>>>> Is there a way to pass a meta value or some identifier of a page to the
>>>> template?
>>>>
>>>> On Sun, Oct 4, 2020 at 8:04 PM J K <[email protected]> wrote:
>>>>
>>>>> Hi Roberto Alsina,
>>>>>
>>>>> Thank you very much. I am able to hide the title now.
>>>>>
>>>>> Also, thank you for pointing me towards creating a custom page.
>>>>> However, I am not that well versed with CSS and am not sure where to 
>>>>> begin.
>>>>> I wondering if there's a quicker way to remove the margins from top and
>>>>> sides?
>>>>>
>>>>> I think (and I may be wrong) that the body formatting comes from this
>>>>> part of the code in base.tmpl. Is there a way to tweak it instead of
>>>>> creating a custom template?
>>>>>
>>>>> ```
>>>>> <div class="container" id="content" role="main">
>>>>>     <div class="body-content">
>>>>>         <!--Body content-->
>>>>>         ${template_hooks['page_header']()}
>>>>>         <%block name="extra_header"></%block>
>>>>>         <%block name="content"></%block>
>>>>>         <!--End of body content-->
>>>>> ```
>>>>>
>>>>> Regards,
>>>>> JK
>>>>> On Friday, October 2, 2020 at 2:18:29 PM UTC+5:30 Roberto Alsina wrote:
>>>>>
>>>>>> To hide the title, just use this in the page's metadata:
>>>>>>
>>>>>> hidetitle
>>>>>>
>>>>>> Set "True" if you do not want to see the page title as a heading of
>>>>>> the output html file (does not work for posts).
>>>>>>
>>>>>> You probably need to use a custom template for that page. There's
>>>>>> documentation on how you can tweak a single page here:
>>>>>> https://getnikola.com/creating-a-custom-page.html
>>>>>>
>>>>>> On Fri, Oct 2, 2020 at 5:36 AM J K <[email protected]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> My query is two fold.
>>>>>>>
>>>>>>>    1. How do I create a full width landing page?
>>>>>>>    I created a basic HTML file as index.html but its contents
>>>>>>>    appear to be held inside a container and don't expand full width. 
>>>>>>> How do I
>>>>>>>    create the index page to display in full width without any padding 
>>>>>>> on the
>>>>>>>    left, right and top?
>>>>>>>    This special condition should apply only to the landing page
>>>>>>>    (index.html) and not to other pages or posts.
>>>>>>>    2. How to remove the title on the landing page?
>>>>>>>    Is there an option not to display title on this particular page?
>>>>>>>
>>>>>>> Currently, this is how my landing page looks. I would like to get
>>>>>>> rid of the spaces shown in red along with the title.
>>>>>>> [image: r0055000.png]
>>>>>>>
>>>>>>> Thanks a lot!
>>>>>>> JK
>>>>>>>
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "nikola-discuss" group.
>>>>>>> To unsubscribe from this group and stop receiving emails from it,
>>>>>>> send an email to [email protected].
>>>>>>> To view this discussion on the web visit
>>>>>>> https://groups.google.com/d/msgid/nikola-discuss/758b3cbf-a1f0-4f3b-93af-dccb6cdbd7adn%40googlegroups.com
>>>>>>> <https://groups.google.com/d/msgid/nikola-discuss/758b3cbf-a1f0-4f3b-93af-dccb6cdbd7adn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>>>> .
>>>>>>>
>>>>>> --
>>>>>
>>>> You received this message because you are subscribed to a topic in the
>>>>> Google Groups "nikola-discuss" group.
>>>>> To unsubscribe from this topic, visit
>>>>> https://groups.google.com/d/topic/nikola-discuss/rbyQGAnIw8s/unsubscribe
>>>>> .
>>>>> To unsubscribe from this group and all its topics, send an email to
>>>>> [email protected].
>>>>> To view this discussion on the web visit
>>>>> https://groups.google.com/d/msgid/nikola-discuss/7b138d7d-e40a-43b8-9d58-21e55286a0e9n%40googlegroups.com
>>>>> <https://groups.google.com/d/msgid/nikola-discuss/7b138d7d-e40a-43b8-9d58-21e55286a0e9n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "nikola-discuss" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>>
>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/nikola-discuss/2c0da5fa-ac87-4861-8f29-57da5281911cn%40googlegroups.com
>>> <https://groups.google.com/d/msgid/nikola-discuss/2c0da5fa-ac87-4861-8f29-57da5281911cn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "nikola-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/nikola-discuss/36c16c9a-a923-454f-ae3c-6fd1d97b7648n%40googlegroups.com
> <https://groups.google.com/d/msgid/nikola-discuss/36c16c9a-a923-454f-ae3c-6fd1d97b7648n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"nikola-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nikola-discuss/CALXDAfoYK%3DsdExT-kfk2Qzrb5Ftqu60RT67h-P1%2BvR_VmZTuMg%40mail.gmail.com.

Reply via email to