lukeorth / poison

Professional Hugo theme for dev bloggers. Based on Mdo's classic Hyde theme.
https://poison.lukeorth.com
GNU General Public License v3.0
198 stars 98 forks source link

My new page is not rendering as a single page #125

Closed D4vidDG closed 1 year ago

D4vidDG commented 1 year ago

Hi! Awesome theme, thank you for creating it.

I'm trying to add a new page different from about that does not render as a list but as a single page.

I added the page in the content folder and the config.toml as stated in the guide:

image

baseURL = "/"
languageCode = "en-us"
theme = "poison"
paginate = 10
pluralizelisttitles = false   # removes the automatically appended "s" on sidebar entries

# NOTE: If using Disqus as commenting engine, uncomment and configure this line
# disqusShortname = "yourDisqusShortname"

[params]
    brand = "Poison"                      # name of your site - appears in the sidebar
    # brand_image = "/images/test.jpg"    # path to the image shown in the sidebar
    description = "Update this description..." # Used as default meta description if not specified in front matter
    dark_mode = true                      # optional - defaults to false
    # favicon = "favicon.png"             # path to favicon (defaults to favicon.png)

    # MENU PLACEHOLDER
    # Menu dict keys:
        # Name:         The name to display on the menu.
        # URL:          The directory relative to the content directory.
        # HasChildren:  If the directory's files should be listed.  Default is true.
        # Limit:        If the files should be listed, how many should be shown.
    menu = [
        {Name = "About", URL = "/about/", HasChildren = false},
        {Name = "foo", URL = "/foo/",HasChildren = false},
        {Name = "Posts", URL = "/posts/", Pre = "Recent", HasChildren = true, Limit = 5}
    ]

    # Links to your socials.  Comment or delete any you don't need/use. 
    github_url = "https://github.com"
    gitlab_url = "https://gitlab.com"
    linkedin_url = "https://linkedin.com"
    twitter_url = "https://twitter.com"
    mastodon_url = "https://mastodon.social"
    tryhackme_url = "https://tryhackme.com"
    discord_url = "https://discord.com"
    youtube_url = "https://youtube.com"
    instagram_url = "https://instagram.com"
    facebook_url = "https://facebook.com"
    flickr_url = "https://flickr.com"
    telegram_url = "https://telegram.org"
    matrix_url = "https://matrix.org"
    xmpp_url = "https://xmpp.org"
    email_url = "mailto://user@domain"

    # NOTE: If you don't want to use RSS, comment or delete the following lines
    # Adds an RSS icon to the end of the socials which links to {{ .Site.BaseURL }}/index.xml
    rss_icon = true
    # Which section the RSS icon links to, defaults to all content. See https://gohugo.io/templates/rss/#section-rss
    rss_section = "posts"

    # Hex colors for your sidebar.
    sidebar_bg_color = "#202020"            # default is #202020
    sidebar_img_border_color = "#515151"    # default is #515151
    sidebar_p_color = "#909090"             # default is #909090
    sidebar_h1_color = "#FFF"               # default is #FFF
    sidebar_a_color = "#FFF"                # default is #FFF
    sidebar_socials_color = "#FFF"          # default is #FFF
    moon_sun_color = "#FFF"                 # default is #FFF
    moon_sun_background_color = "#515151"   # default is #515151

    # Hex colors for your content in light mode.
    text_color = "#222"             # default is #222
    content_bg_color = "#FAF9F6"    # default is #FAF9F6
    post_title_color = "#303030"    # default is #303030
    list_color = "#5a5a5a"          # default is #5a5a5a
    link_color = "#268bd2"          # default is #268bd2
    date_color = "#515151"          # default is #515151
    table_border_color = "#E5E5E5"  # default is #E5E5E5
    table_stripe_color = "#F9F9F9"  # default is #F9F9F9

    # Hex colors for your content in dark mode
    text_color_dark = "#eee"                # default is #eee
    content_bg_color_dark = "#121212"       # default is #121212
    post_title_color_dark = "#DBE2E9"       # default is #DBE2E9
    list_color_dark = "#9d9d9d"             # default is #9d9d9d
    link_color_dark = "#268bd2"             # default is #268bd2
    date_color_dark = "#9a9a9a"             # default is #9a9a9a
    table_border_color_dark = "#515151"     # default is #515151
    table_stripe_color_dark = "#202020"     # default is #202020
    code_color = "#bf616a"                  # default is #bf616a
    code_background_color = "#E5E5E5"       # default is #E5E5E5
    code_color_dark = "#ff7f7f"             # default is #ff7f7f
    code_background_color_dark = "#393D47"  # default is #393D47

    # NOTE: If using Remark42 as commenting engine, uncomment and configure these lines
    # remark42 = true
    # remark42_host = "https://yourhost.com"
    # remark42_site_id = "your_site_id"

    # NOTE: The following three params are optional and are used to create meta tags + enhance SEO.
    # og_image = ""                       # path to social icon - front matter: image takes precedent, then og_image, then brand_url
                                          # this is also used in the schema output as well. Image is resized to max 1200x630
                                          # For this to work though og_image and brand_url must be a path inside the assets directory
                                          # e.g. /assets/images/site/og-image.png becomes images/site/og-image.png
    # publisher_icon = ""                 # path to publisher icon - defaults to favicon, used in schema

[taxonomies]
    series = 'series'
    tags = 'tags'

And the page's .md file has 'layout:single' in the frontmatter.

---
layout: single
draft: false
---
# Foo

wmadopamdopamdopam

However, when loading the page, 'foo' is not rendered the same as 'about'. It seems like it's trying to be rendered as a list. Not sure why.

image

Thanks for your help!

lukeorth commented 1 year ago

Hi @D4vidDG, thank you for using the theme. I'm glad you like it. :slightly_smiling_face:

In order to render that page with the single template, you must rename foo.md to be _index.md. This will tell Hugo that it should be rendered as a single page. Other than that, all of your other configurations are correct!

Please let me know if this fixes your issue.

D4vidDG commented 1 year ago

Heey. I did that and left everything else as it was. image The problem is that now my page doesn't appear in the sidebar for some reason. image However, when I type the URL of my page, it is displayed as it should.

image

If it helps:

D4vidDG commented 1 year ago

I found the issue. I needed to provide a title and a date in the front matter so the page appears in the menu.

image

I don't know if this is related to the theme or my lack of experience with Hugo. Anyway, thanks again for your support! I'm closing this issue.

lukeorth commented 12 months ago

Awesome! I'm glad it's working now. 🙂

dasbootbee commented 3 months ago

I'm having difficulty getting this to work. When I rename the file in the directory to _index.md, I get page with a title but no other text.

Here is the structure:

image

The _index.md file: image

And here is what I'm seeing:

image

Using the layout: single (or layout = single) throws an error.

D4vidDG commented 2 months ago

Have you tried following the format for the front matter that I showed in an image? Try replacing +++ with ---, and also change the equals signs (=) with two points (:)