Recent posts not showing on sidebar

Hi

New Edit: Sorry for not giving all the info required

GT

I’m currently using the Mainroad theme for my offline website, soon to be launched via Netlify when all the posts have been tidied up. I am not using GitHub.

At some point I must have deleted reference to the recent post widget on my config.toml file, but I replaced it later. Unfortunately, it does not show up on my sidebar anymore.

config.toml:

baseURL = '/'
languageCode = 'en-gb'
title = ""
theme  = "Mainroad"
contentDir = "content"
paginate = "10" # Number of posts per page
disqusShortname = "" # Enable Disqus comments by entering your Disqus shortname
googleAnalytics = "" # Enable Google Analytics by entering your tracking id

[taxonomies]
  category = 'categories'
  tag = 'tags'

[menu]
[[menu.main]]
  name = 'Home'
  url = '/'
  weight = 10
[[menu.main]]
  name = 'Fearless Francis'
  url = '/categories/Fearless Francis'
  weight = 20
[[menu.main]]
  name = 'Journeys Past'
  url = '/categories/Journeys Past'
  weight = 30
[[menu.main]]
  name = 'TitBits'
  url = '/TitBits'
  weight = 40
[[menu.main]]
  name = 'Glasgow Links'
  url = '/WebLinks'
  weight = 50

[Author] # Used in authorbox
  # name = "© Wishart Frankfield"
  # bio = "Retired gentleman from Scotland"
  # avatar = "img/WF.png"

[Params]
  description = "Unusual tales about Glasgow" # Site description. Used in meta description
  copyright = "Wishart Frankfield" # Footer copyright holder, otherwise will use site title
  opengraph = true # Enable OpenGraph if true
  schema = true # Enable Schema
  twitter_cards = false # Enable Twitter Cards if true
  readmore = true # Show "Read more" button in list if true
  authorbox = false # Show authorbox at bottom of pages if true
  toc = true # Enable Table of Contents
  pager = true # Show pager navigation (prev/next links) at the bottom of pages if true
   post_meta = ["author", "date", "categories", "translations"] # Order of post meta information
  mainSections = ["post", "blog", "news"] # Specify section pages to show on home page and the "Recent articles" widget
  dateformat = "02-01-2006" # Change the format of dates
  mathjax = true # Enable MathJax
  mathjaxPath = "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.6/MathJax.js" # Specify MathJax path
  mathjaxConfig = "TeX-AMS-MML_HTMLorMML" # Specify MathJax config
  googleFontsLink = "https://fonts.googleapis.com/css?family=Open+Sans:400,400i,700" # Load Google Fonts
  customCSS = ["css/custom.css"] # Include custom CSS files
  customJS = ["js/custom.js"] # Include custom JS files

  
[Params.style.vars]
  highlightColor = "#e22d30" # Override highlight color

  # Override font-family sets
  # Take care of different quotes OR escaping symbols in these params if necessary
  fontFamilyPrimary = "'Open Sans', Helvetica, Arial, sans-serif"
  # Secondary font-family set responsible for pre, code, kbd, and samp tags font
  fontFamilySecondary = "SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace"

[Params.logo]
  image = "/img/test_2.jpg" # Logo image. Path relative to "static"
  # title = "Glasgow Tales" # Logo title, otherwise will use site title
  # subtitle = "Strange stories from Scotland's Second City" # Logo subtitle

[Params.thumbnail]
  visibility = ["list", "post"] # Control thumbnail visibility

[Params.sidebar]
  home = "right" # Configure layout for home page
  list = "right"  # Configure layout for list pages
  single = "right" # Configure layout for single pages
  # Enable widgets in given order
   widgets = ["social", "recent", "taglist"]

[Params.widgets]
  recent_num = 3 # Set the number of articles in the "Recent articles" widget
  categories_counter = false # Enable counter for each category in "Categories" widget
  tags_counter = true # Enable counter for each tag in "Tags" widget


[Params.widgets.social]
  # Enable parts of social widget
  email = "wishart.frankfield@gmail.com"

[Params.widgets.search]
  # url = "https://google.com/search"
  # input.name = "sitesearch"
  # input.pre = ""

Thanks
Wishart

We can’t see your site or your code, I don’t see how anyone can help you.

See How to request help.

1 Like

Also, kindly wrap your code in backticks (</> icon) for easier readability.

1 Like

My apologies folks. I had some visitors in and rushed my question.

I’m edited my original post.

Wishart

You are more likely to receive a prompt and accurate response if you post a link to the public repository for your project.

See https://discourse.gohugo.io/t/requesting-help/9132.

Let us see your code

Include a link to the source code repository of your project, because we really need the context of seeing your templates and partials to be able to help you. It is trivial to do a quick git clone on your repo, then run hugo server in your project, to help you out. On the other hand, recreating your code from screenshots, or sort of guessing at it, is not.

If you can’t share your repository for whatever reason, consider creating a dummy repo that you can share, which reproduces the problem you’re experiencing.

1 Like

Issue resolved. Worked out that it should have been the section names, as follows:

mainSections = [“Francis”, “Journeys”, “TitBits”] # Specify section pages to show on home page and the “Recent articles” widget

Everything’s working fine now

Wishart

Not to put too sharp an edge on this, but, if you had shared your project with us in your initial post, your issue would probably have been resolved three hours ago.

Just something to keep in mind for the future…

1 Like

hmmmm, I did mention that I had visitors come in as I was posting this question. I knew the answer lay in the config.toml file, since it worked before I tampered with it.

I don’t use GitHub, but I’m familiar with html. I’ve used the excellent Mainroad theme before, so I was confident that there were no issues. I tend only to tinker with the CSS.

Anyway, it was an interesting first post. I’ll certainly do my homework if I have to post again. In the meantime, thanks for all your comments.

Best wishes
Wishart

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.