tmaiaroto / hugo-redlounge

A Hugo theme
Other
100 stars 65 forks source link

Add a parameter to let user can set the sidebar photo #19

Closed lucumt closed 9 years ago

lucumt commented 9 years ago

Many blogs have the function to let users set their own photo,so I changed some code and added a parameter to let the user can set the sidebar photo via the config.toml file,please check it.thanks!

tmaiaroto commented 9 years ago

Sounds good! Thanks!

lucumt commented 9 years ago

Hi Tom! I found your blog theme was very beautiful and I want to use it to build my own blog.But I have two problems I do not know how to solve it,so I want to ask from you:

A. I want to add an about me page to show the information for myself,then I create it via: hugo add about.md, then the page will also appear on the home page,but I do not want to it display on the home page,what shall I do to exclude the about page from the home page?

B. Since your blog has not support pagination well,so I want to create an page to show the blog list(only tile and create time) and aslo do not want to it show in the home page,could you give me some advice,please?

Thanks in advance!

tmaiaroto commented 9 years ago

I'd just take a look at the documentation, really. I'm not exactly sure what you're after, but it should be configurable.

A. For your about page being in the menu, you can look at: http://gohugo.io/extras/menus The sidebar displays the main menu found in your config.toml file, so take a look there.

B. Yes, this theme was created before pagination. I've been meaning to update it. You can overwrite th theme's template by adding your own, see: http://gohugo.io/templates/list/

lucumt commented 9 years ago

Hi Tom, Thanks for your reply, for question A,I would like to build my blog as yours,to add an about me page and do not let it show in the home page,as you know each time we create a new page it will also shown in the homepages.

I have read the http://gohugo.io/extras/menus document for many times,and I aslo analysis your github code for several times,but still do not find an easy way,could you tell me how you add an About page in your blog site:http://www.shift8creative.com/? about

Thanks

tmaiaroto commented 9 years ago

Ensure it's in your main menu:

[[menu.main]]
    name = "About"
    url = "/about"

Then make sure the about.md that you created at the root has some settings to keep it from appearing elsewhere, to set a header image if you want, to prevent commenting, and so on:

date = 2014-10-01T05:34:01Z
draft = false
title = false
author = "Tom"
nocomment = true
totop = false
socialsharing = false
banner = "/img/el-capitan.jpg"
bannerheight = 350
noauthor = true
nodate = true
noread = true
nopaging = true
notoc = true
lucumt commented 9 years ago

Hi Tom, I am very sorry to disturb you again,it seems that ,but it seems you still do not know what I want to do.

I know how to modify and configure the menu in your theme before asking the question to you and I have added the ABOUT menu as the picture shown below.

But as I said twice before,the about page content appears on the homepage,when I type http://127.0.0.1:1313,the homepage will appear,and the ABOUT content will also shown inside it,just as the picture shown below.

So my question is:How can I prevent the about page content show in the homepage?, hope you can understand my requirements.

Thanks in advance!

about2

tmaiaroto commented 9 years ago

Override the home page layout template under layouts/index.html so that it doesn't list anything that isn't pinned. Note the difference between the theme and my override.

{{ range .Site.Recent }}
                {{ if .Params.pinned }}

Nothing will appear on your home page until it has pinned = true in its front matter. This is more or less how I control what is "featured" on my site and is how the home page differs from the blog list which will only list things of that archetype (of which the about page is not).

Here is my custom home page template exactly:

{{ partial "header.html" . }}
<body>
    <div id="layout" class="pure-g">
        {{ partial "sidebar.html" . }}

        <div class="content pure-u-1 pure-u-md-3-4">
            <a name="top"></a>
            {{ partial "listtop.html" . }}

            <div class="posts">
                {{ range .Site.Recent }}
                {{ if .Params.pinned }}
                <section  class="post">
                    <header class="post-header">
                        {{ if .Params.thumbnail }}
                        <div class="post-avatar-wrapper">
                            <img class="post-avatar" alt="" src="{{ .Params.thumbnail }}">
                        </div>
                        {{ end }}
                        <h1 class="post-title">
                          <a href="{{ .RelPermalink }}">{{ .Title }}</a>
                      </h1>
                  </header>
                  <p class="post-meta">
                      {{ if not .Params.nodate }}
                      <span class="post-date">
                        <span class="post-date-day"><sup>{{ .Date.Format "2" }}</sup></span><span class="post-date-separator">/</span><span class="post-date-month">{{ .Date.Format "Jan" }}</span> <span class="post-date-year">{{ .Date.Format "2006" }}</span>
                    </span>
                    {{ end }}
                    {{ if not .Params.noauthor }}
                        {{ if .Params.author }}By <a class="post-author" {{ if .Params.authorlink }}href="{{ .Params.authorlink }}"{{ end }}>{{ .Params.author }}</a>{{ end }}
                    {{ end }}
                    {{ if not .Params.noread }}
                        <span class="post-reading-time"><i class="fa fa-clock-o"></i> <em>{{.ReadingTime}} min. read</em></span>
                    {{ end }}
                    {{ if .Params.categories }}
                    <div class="post-categories">
                        {{ range .Params.categories }}
                        <a class="post-category post-category-{{ . | urlize }}" href="/categories/{{ . | urlize }}">{{ . }}</a> 
                        {{ end }}
                    </div>
                    {{ end }}
                </p>
                <article class="post-summary">
                      {{ .Summary }}
                  </article>
                  <div class="read-more-link">
                      <a href="{{ .RelPermalink }}"><span class="read-more-slashes">//</span>Read More...</a>
                  </div>
              </section>
              {{ end }}
              {{ end }}
            </div>

        {{ partial "footer.html" . }}
        </div>
    </div>
    {{ partial "bodyend.html" . }}
</body>
</html>