gethugothemes / liva-hugo

Liva is a personal blog template powered by Hugo.
https://gethugothemes.com/products/liva/?utm_source=liva_github&utm_medium=referral&utm_campaign=github_theme_about
MIT License
276 stars 235 forks source link

Search returns 404 #44

Open xavierraffin opened 3 years ago

xavierraffin commented 3 years ago

I am running a blog with Liva and the search results page returns 404.

URL: https://visualping.io/blog/ Search result: https://visualping.io/blog/search?s=monitor

My config.toml:

######################## default configuration ####################
baseURL = "https://visualping.io/blog"
languageCode = "en-us"
title = "Visualping blog"
theme = "liva"
summaryLength = "20"
paginate = 6
disqusShortname = ""
relativeURL = "true"
DefaultContentLanguage = "en"

[outputs]
  home = ["HTML", "AMP", "RSS", "JSON"]

############################# Plugins ##############################
[params.plugins]

  # CSS Plugins
  [[params.plugins.css]]
  URL = "plugins/bootstrap/bootstrap.min.css"
  [[params.plugins.css]]
  URL = "plugins/slick/slick.css"
  [[params.plugins.css]]
  URL = "plugins/themify-icons/themify-icons.css"
  [[params.plugins.css]]
  URL = "plugins/venobox/venobox.css"

  # JS Plugins
  [[params.plugins.js]]
  URL = "plugins/jQuery/jquery.min.js"
  [[params.plugins.js]]
  URL = "plugins/bootstrap/bootstrap.min.js"
  [[params.plugins.js]]
  URL = "plugins/slick/slick.min.js"
  [[params.plugins.js]]
  URL = "plugins/venobox/venobox.min.js"
  [[params.plugins.js]]
  URL = "plugins/search/fuse.min.js"
  [[params.plugins.js]]
  URL = "plugins/search/mark.js"
  [[params.plugins.js]]
  URL = "plugins/search/search.js"

############################## navigation ###############################
[menu]

  # main menu
  [[menu.main]]
  name = "Home"
  URL = "https://visualping.io"
  weight = 1

  [[menu.main]]
  name = "Blog"
  URL = "/"
  weight = 2
...

#################### default parameters ################################
[params]
logo = "images/logo-blue@2x.png"
logoDark = "images/logo-dark.png"
clock = "images/icon-clock.png"
home = "Home"
# Meta data
...

  # Preloader
  [params.preloader]
  enable = true
  preloader = "" # use .png , .svg or .gif format

  # search
  [params.search]
  enable = true

############################# social site ########################
[[params.social]]
title = "twitter"
icon = "ti-twitter-alt" # themify icon : https://themify.me/themify-icons
link = "https://twitter.com/intent/tweet?url="
...

################################ languages #############################

[languages]
  [languages.en]
    languageName = "English"
    contentDir = "content/en"
    title = "The Visualping Blog"
    weight = 1
    ...

Example search results (403 from S3 because the target file do not exist). It returns a 404 when running locally.

https://visualping.io/blog/search?s=monitor

Thank you very much for your help

somratpro commented 3 years ago

Hello @xavierraffin

Sorry for the late reply, I didn't notice this issue. I visit your site and didn't recognize the theme. Also, I noticed that your search still not working. can you tell me which theme you are using?

xavierraffin commented 3 years ago

Thank you for coming back to me @somratpro!

We use the theme from this current repo. See the theme.toml:

ame = "Liva Hugo"
license = "MIT"
licenselink = "https://github.com/themefisher/liva-hugo/blob/master/LICENSE"
description = "Hugo port of the Themefisher’s Liva Template"
homepage = "https://gethugothemes.com/shop/"
tags = ['landing-page', 'fast', 'light', 'white', 'modern', 'themefisher', 'hugo-theme', 'hugo-templates', 'bootstrap', 'blog', 'responsive', 'clean', 'simple', 'creative', 'contact-form', 'custom-themes', 'mobile', 'minimalistic', 'pages', 'resume', 'portfolio', 'google analytics', 'customizable', 'flexbox', 'presentation', 'product', 'theme', 'typography']
features = ['bootstrap','responsive']
min_version = "0.58.0"

[author]
  name = "Themefisher"
  homepage = "https://themefisher.com/"

We made some graphical customization from the original. But I don't know how the search is supposed to work, and was trying to get help here.

somratpro commented 3 years ago

Hey @xavierraffin

I check our live demo, and the search is working fine. I think you messed up with search when you customized this theme. Probably you removed the search.md file from content folder. I want to let you know that, we give custom support, if you are interested, you can contact at mehedi@themefisher.com. thank you

Ankit-Gupta18 commented 2 years ago

@somratpro @tfsomrat I am facing the same issue. And I forked it from the original repo but still search doesn't work. How can I fix it? @xavierraffin how did you fix it?

xavierraffin commented 2 years ago

@Ankit-Gupta18 it was a problem with Hugo Liva and our CDN, the path for search was not transmitted properly:

Here is the code change:

in blog/themes/liva/layouts/partials/header.html:

---            <form action="{{ .Site.BaseURL }}/search" class="h-100">
+++          <form action="{{ .Site.BaseURL }}search/" class="h-100">
Ankit-Gupta18 commented 2 years ago

@Ankit-Gupta18 it was a problem with Hugo Liva and our CDN, the path for search was not transmitted properly:

Here is the code change:

in blog/themes/liva/layouts/partials/header.html:

---            <form action="{{ .Site.BaseURL }}/search" class="h-100">
+++          <form action="{{ .Site.BaseURL }}search/" class="h-100">

image Still this.. Any more change?

sugardayfox commented 1 year ago

I just tried it and their search seems to work just fine.