alanorth / hugo-theme-bootstrap4-blog

A blogging-centric Bootstrap v4 theme for the Hugo static site generator.
Other
204 stars 132 forks source link

Tags are meaningless #91

Closed nebkor closed 6 years ago

nebkor commented 6 years ago

Right now, there is no filtering based on tags.

Steps to reproduce:

  1. visit https://picturingjordan.com/tags/amman/

Expected behavior: only posts tagged "amman" are displayed

Observed behavior: all posts are displayed, up to the limit set in the config.toml file for how many posts to display, regardless of how they're tagged

This can also be observed by running hugo server in the exampleSite directory from this repo.

fte378 commented 6 years ago

I can't confirm this for my blog (frank.tegtmeyer.net) - I'm on head revision for the theme, so there must be another problem.

alanorth commented 6 years ago

@nebkor Wow, I think you're reporting bugs affecting my blog itself! You are right that filtering doesn't work there, but @fte378 is right that it works on his. I will investigate.

nebkor commented 6 years ago

Hey Alan and Frank, thanks for chiming back in! @fte378 can you say your commit by hash? It can be reproduced by checking out the tip of master (f13e1c6e6f2679339194c706bed15d286b9b73ba) and running the Hugo server in the exampleSite dir. [edit: did a git checkout 99acad5 && npm install && npm run build and rebuilt my site, tags work again]

I'm using Hugo v0.38.2, and my config.toml file is:

baseURL = "https://blog.joeardent.net/"
languageCode = "en-us"
title = "A Sacred Mockery of a Profane World"

# Hugo variables
#
theme = "hugo-theme-bootstrap4-blog"
# number of posts to show on home/category/tag pages (Default: 10)
#paginate = 1
# optionally override the site's footer with custom copyright text
copyright = "Except where otherwise noted, content on this site is licensed under a [Creative Commons Attribution 4.0 International license](https://creativecommons.org/licenses/by-sa/4.0/)."
#googleAnalytics = "UA-123-45"
#disqusShortname = "XYW"

[permalinks]
  post = "/:year/:month/:title/"
  page = "/:slug/"

[taxonomies]
  categories = "categories"
  tags = "tags"

# [[menu.sidebar]]
#   name = "Link 1"
#   url = "https://example.com"

# [[menu.sidebar]]
#   name = "Link 2"
#   url = "https://example.org"

#[[menu.navbar]]
#  name = "Link 1"
#  url = "https://example.org"

[mediaTypes]
  [mediaTypes."application/atom"]
  suffix = "xml"

[outputFormats.Atom]
  mediaType = "application/atom"
  baseName = "index"
  isPlainText = false

[outputs]
  home = [ "HTML", "Atom" ]

# Theme variables
#
[params]
  # Site author
  author = "Joe Ardent"

  # Description/subtitle for homepage (can be Markdown)
  # description = "A simple Hugo theme based on the Bootstrap v4 blog example."

  # Format dates with Go's time formatting
  date_format = "Mon Jan 02, 2006"

  # verification string for Google Webmaster Tools
  #google_verify_meta = "BAi57DROASu4b2mkVNA_EyUsobfA7Mq8BmSg7Rn-Zp9"

  # verification string for Bing Webmaster Tools
  #bing_verify_meta = "3DA353059F945D1AA256B1CD8A3DA847"

  # verification string for Yandex Webmaster Tools
  #yandex_verify_meta = "66b077430f35f04a"

  # Optionally display a message about the site's use of cookies, which may be
  # required for your site in the European Union. Set the parameter below to a
  # page where the user can get more information about cookies, either on your
  # site or externally, for example:
  #cookie_consent_info_url = "/cookie-information/"
  #cookie_consent_info_url = "http://cookiesandyou.com"

  # show sharing icons on pages/posts (default: true)
  sharingicons = false

  # Display post summaries instead of content in list templates (default: true)
  #truncate = false

  # Disable the use of sub-resource integrity on CSS/JS assets (default: false)
  # Useful if you're using a CDN or other host where you can't control cache headers
  #disable_sri = false

  [params.sidebar]
    # Optional about block for sidebar (can be Markdown)
    about = "This is my deal."

    # How many posts to show on the sidebar (Default: 5)
    #num_recent_posts = 2

  [params.social]
    # Optional, used for attribution in Twitter cards (ideally not a person
    # for example: nytimes, flickr, NatGeo, etc).
    # See: https://dev.twitter.com/cards/types/summary-large-image
    # twitter = "username"

# Default content language for Hugo 0.17's multilingual support (default is "en")
# See: https://github.com/spf13/hugo/blob/master/docs/content/content/multilingual.md
#DefaultContentLanguage = "en"

# Languages to render
#[languages.en]
#[languages.bg]

# vim: ts=2 sw=2 et
fte378 commented 6 years ago

Ahh - sorry I forgot that I turned off the auto-fetch in my git client. I'm still on 99acad59 (Regenerate style.css)

So it's likely that my blog would have the problem too (can't check now - maybe in three hours).

ahal commented 6 years ago

Can reproduce as well on f13e1c6. Glad I checked here before spending too much time investigating :).

nebkor commented 6 years ago

I've confirmed that using 99acad5 correctly renders the tags with the config.toml and Hugo versions I've given.

alanorth commented 6 years ago

@nebkor Good work! It looks like the commit responsible for this is the one directly after that (1655b876a8f7cf3c4b9d3a2006e645ffb2504977), which was to fix #89.

Filtering by taxonomies always "just worked" so I never had to figure out how it worked. Let me investigate.

alanorth commented 6 years ago

I think I get it. In layouts/_default/list.html I always iterate over all pages, not just those in the current context:

{{ $paginator := .Paginate (where .Site.Pages "Section" "in" .Site.Params.mainSections) }}

The list template is used for the the homepage as well as taxonomy lists. In this case I think I just need to create a taxonomy list template.

alanorth commented 6 years ago

I've fixed this by introducing a taxonomy template. See: https://github.com/alanorth/hugo-theme-bootstrap4-blog/commit/400357930a08a962bfaf6b34587525e0e3c2404d. Thanks for all the help, people!

nebkor commented 6 years ago

Thank you so much for the prompt fix!