Full width landing page without a title

45 views
Skip to first unread message

J K

unread,
Oct 2, 2020, 4:36:23 AM10/2/20
to nikola-discuss
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.
r0055000.png

Thanks a lot!
JK

Roberto Alsina

unread,
Oct 2, 2020, 4:48:29 AM10/2/20
to Nikola—Discuss
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


--
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 nikola-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/758b3cbf-a1f0-4f3b-93af-dccb6cdbd7adn%40googlegroups.com.

J K

unread,
Oct 4, 2020, 10:34:30 AM10/4/20
to nikola-discuss
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

J K

unread,
Oct 4, 2020, 4:15:21 PM10/4/20
to nikola-...@googlegroups.com
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?

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 nikola-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/7b138d7d-e40a-43b8-9d58-21e55286a0e9n%40googlegroups.com.

J K

unread,
Oct 12, 2020, 5:01:45 AM10/12/20
to nikola-discuss
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.

Roberto Alsina

unread,
Oct 12, 2020, 5:07:31 AM10/12/20
to Nikola—Discuss
I think you should just use post.meta(keyname) instead of page.meta



J K

unread,
Oct 15, 2020, 1:19:21 AM10/15/20
to nikola-discuss
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.

Roberto Alsina

unread,
Oct 15, 2020, 4:54:27 AM10/15/20
to Nikola—Discuss
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

Reply all
Reply to author
Forward
0 new messages