Code Monkey home page Code Monkey logo

hugo-modules's People

Contributors

aleixripoll avatar arjenbrandenburgh avatar deining avatar divinerites avatar marcuswu avatar mehedi-sharif avatar msdundar avatar patgmiller avatar somratpro avatar terwey avatar tffarhad avatar tflijon avatar tfsojon avatar tfsomrat avatar tfsumon avatar thierry-tct avatar vascoguita avatar xai avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hugo-modules's Issues

Imports for shortcodes doesn't work suddenly

Suddenly, the shortcodes stopped working.

I have errors like this and I can complete the build:

failed to extract shortcode: template for shortcode "changelog" not found

I use andromeda premium theme.

Banner loading attribute not updating from "lazy" to "eager" or default

Description:

I am trying to change the loading attribute of the banner from "lazy" to "eager" or to the default value by setting an empty string. However, updating the attribute does not seem to have any effect. I have already updated all the relevant modules using yarn update.

Steps to reproduce:

  1. Update the loading attribute in the banner partial by replacing "lazy" with "eager" or an empty string ("").
    
  2. Save the changes and build the project.
    
  3. Observe that the banner loading behavior remains unchanged.
    

Expected behavior:

Changing the loading attribute in the banner partial should update the loading behavior of the banner image to either "eager" or the default value.

Actual behavior:

The banner loading behavior remains unchanged even after updating the attribute.

Code snippet:

{{ with .Params.banner }}
<section class="banner">
  <div class="container">
    ...
        {{ partial "image" (dict "Src" .image "Loading" "eager" "Alt" .title "Class" "rounded-2") }}
  ...
</section>
{{ end }}
<!-- /banner -->

Additional context:
I have tried updating all the modules using yarn update but the issue persists. Please let me know if there's any other information needed to resolve this issue.

Bug - Search module Error On Enter Handler

Recently when the html classes where changed to the modal search, I think a class name change was missed.

So now when using the using the keys to browse, and Enter is pressed to navigate to the currently selected item, nothing happens. The following error is logged in the console

Uncaught TypeError: Cannot read properties of undefined (reading 'getAttribute')
    at HTMLInputElement.handleKeyDown (script.js:199:17)

Search XSS vulerability

With search enabled, using the "s=" URL parameter it is possible to inject and execute code in the client browser.
Example: https://my.hugo.page/?s=sxss1'<%2F"></b><img src=1 onerror=alert(document.domain)>

The "s=" parameter should be removed or fixed using encodeURIComponent() before inserting the query parameter into the DOM.

Need more detailed instruction on modules install and use

I made everything according instruction about adding gallery, and have imported the module.

hugo mod graph
github.com/42point/newBlog github.com/gethugothemes/hugo-modules/[email protected]
github.com/42point/newBlog PaperMod

But, I didn't get glightbox.js or glightbox.css files in static folder of my project. Do I need to clone them from the repository?

How does it work?

I use YAML format for the config file

Params:
  plugins:
    css:
      - link: plugins/glightbox/glightbox.css
    js:
      - link: plugins/glightbox/glightbox.js
      - link: js/gallery-slider.js

thanks in advance.

i18n for cookie-consent

It looks like the cookie-consent module cannot use i18n. It uses cookies.content and cookies.button without going through translations.
Is it possible to work this around? It would be quite useful (if not mandatory) for multilingual sites.
Many thanks!

Shortcode implementation of image Resize command conflicts with Resize command in hugo

The current image shortcode implementation of the image Resize command directly passes on the dimensions provided by the user. It uses the ones from the original image as a fallback, disregarding the aspect ratio. The second part violates the definition of the Resize command in hugo, which states that the aspect ratio is preserved if only one dimension is specified in a Resize command.

As an example, when specifying a shortcode such as {{< image src="image.png" width="200" command="Resize" title="An example image">}}, the height is currently set to the height of the original image, which also has an effect the aspect ratio.

Suggestion for canonical tag in basic-seo.html

instead of:
{{ with .Params.canonical }}

{{ end }} which only works if you set a non empty property for "canonical" property

Use this:
{{ if .Params.canonical.enable }}
{{ with .Params.canonical.link }}

{{ else }}

{{ end }}
{{ end }}

it gives the user a choice wheather or not to have a canonical tag (which by default is the page itself) or to add a URL to another page.

Update twitter logo in social-share

The Social-share is still using the old twitter logo.

Would be good to update to the new one. With the following svg.

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
 <path d="M178.57 127.15 290.27 0h-26.46l-97.03 110.38L89.34 0H0l117.13 166.93L0 300.25h26.46l102.4-116.59 81.8 116.59h89.34M36.01 19.54H76.66l187.13 262.13h-40.66"/>
</svg>

Accordian doesnt display all code.

When I moved from using "Collapse" to using "Accordion" correctly, I noticed that the chunk of code I placed into the new "Accordion" shortcode wasn't all displayed. Half the code was cut off. Can this be fixed?

Tabs header are not responsive

When there are many tabs, and the webpage is viewed on a small screen (like mobile phone), the right most tabs overflow and are not (or partially) seen.
Maybe the tab headers can be stacked for small screens.

{{< tabs "tab-group-name" >}}
{{< tab "first-long-name" >}}
First Tab 1
{{< /tab >}}

{{< tab "second" >}}
Second Tab 1
{{< /tab >}}

{{< tab "third" >}}
Third Tab 1
{{< /tab >}}

{{< tab "fourth" >}}
Fourth Tab 1
{{< /tab >}}
{{< /tabs >}}

Build error related to Page Bundles images after commit 27be1f6

An issue has arisen following the commit 27be1f6. Since this commit, I've been encountering a specific build error related to template rendering in my Hugo site that wasn't present before. The error occurs during the site rendering process, particularly when processing the list.searchindex.json template. Here's the error message:

Error: error building site: render: failed to render pages: render of "home" failed: "hugo-modules/search/layouts/_default/list.searchindex.json:25:67": execute of template failed: template: _default/list.searchindex.json:25:67: executing "_default/list.searchindex.json" at <.Page>: can't evaluate field Page in type string

Before this commit, my site was built without any issues. However, there was a pre-existing problem where images were not displaying in the search results for entries using Page Bundles. The front matter for these entries is typically as follows:

---
title: 'Some Title'
images: ['image.png']
...
---

For items where the front matter is formatted like this:

---
title: 'Some Title'
images: ['/images/image.png']
...
---

images display correctly in the search results, provided that the list.searchindex.json code is as it was before the commit 27be1f6.

It seems that the recent changes might have affected how Page Bundles and their associated images are handled or rendered. I would appreciate any assistance or guidance on resolving this error to restore the site's functionality and ensure images are displayed correctly in the search results.

Search module doesn't search sections which contain hyphens

The search module seems to find results on sections which do not contain hyphens but two of my sections which contain hyphens (such as a section called "how-to") never returns any results. I spent a little bit of time trying to debug the JavaScript but I haven't found the root cause yet. I believe it occurs in the doSearch function when deciding which sections to filter out.

If you could look into this issue, that would be great! I can't change my section names to remove the hyphen since my website is established and that would change the URLs of those sections/pages.

I never had this issue before the Logbook theme was updated to make use of the new hugo modules.

It should be possible to enable/disable lazy loading for each image component individually

I bought a theme from gehugothemes and unfortunately it's SEO score isn't as great as I'd like to. One of the reasons is that the largest image on the top of the page is lazy loaded which causes page content re-render after it was already rendered.

The obvious solution is to change loading strategy to eager BUT:

Problem #1:
There is no info in the official documentation on how to change the loading strategy. I had to open the source code for that.
Not a huge issue but I'd prefer to have this configuration documented.

Problem #2
Changing loading strategy doesn't work.
I have the following code:

{{ partial "image.html" (dict "Loading" "eager" "Src" .image "Alt" .Title "Class" "rounded-2 shadow" ) }}

I'd expect that rendered HTML tag has an attribute "loading=eager" but unfortunately it is still loading=lazy

Config Folder

Hi, I don't have a config folder

.git
.hugo_build.lock
archetypes
config.toml
content
data
i18n
public
resources
sitemap.xml
static
themes

Outline buttons acting strange

I've recently updated my module from buttons to button. The button module is behaving funny when using the outline style which I prefer. Your documentation doesnt state I need to update my style.cscss with "@import button;". So I left the "@import buttons;" alone. On the grid view homepage, buttons are working as they should.

Following your instructions, the following occurs when I try to use a button with an outline style in a post

image
(not all the outline is working the button should have a full blue outline on my test, but its missing the bottom line)

In addition to this button text isnt changing with the theme, to white, like it should when I hover over the button.
image

Params are set as they should be.

Search through the whole website

Hi, guys.

I have a question. Is it possible to organize a search throughout the whole website, without connection to sections or other internal structure, as I am having difficulties with it. I use some hugo theme for my website and heavily modified it. Whatever I've done so far, search was working only in some particular folders (i.e. "Blogs" and "People") which probably has some "proper" internal structure (_index.md, list.html template, single.html template) and not for the whole website. I also have general single md files in the root folder and would like the search to work on them too. Is it possible to implement?

Thank you in advance!

Search module does not display page bundle images

Search module only displays images with absolute URLs, the context is not sent to thesearchImage partial so it uses the default "dot":

{{- if .Params.image -}}
{{- $.Scratch.Set "image" (partial "searchImage" (dict "Src" .Params.image "Size" "420x" "Command" "Resize")) -}}
{{- $.Scratch.Set "imageSM" (partial "searchImage" (dict "Src" .Params.image "Size" "100x100" "Command" "Fill")) -}}
{{- else if .Params.images -}}
{{- range first 1 .Params.images -}}
{{- $.Scratch.Set "image" (partial "searchImage" (dict "Src" . "Size" "420x" "Command" "Resize")) -}}
{{- $.Scratch.Set "imageSM" (partial "searchImage" (dict "Src" . "Size" "100x100" "Command" "Fill")) -}}
{{- end -}}
{{- end -}}

For page bundles, Context must be set to .Page:

{{- if .Params.image -}}
  {{- $.Scratch.Set "image" (partial "searchImage" (dict "Context" .Page "Src" .Params.image "Size" "420x" "Command" "Resize")) -}}
  {{- $.Scratch.Set "imageSM" (partial "searchImage" (dict "Context" .Page "Src" .Params.image "Size" "100x100" "Command" "Fill")) -}}
{{- else if .Params.images -}}
  {{- range first 1 .Params.images -}}
  {{- $.Scratch.Set "image" (partial "searchImage" (dict "Context" .Page "Src" . "Size" "420x" "Command" "Resize")) -}}
  {{- $.Scratch.Set "imageSM" (partial "searchImage" (dict "Context" .Page "Src" . "Size" "100x100" "Command" "Fill")) -}}
  {{- end -}}
{{- end -}}

question getting the tabs shortcode to run

hi! i'm able to get the html version of this module to work in my site if i add it to a template

Screen Shot 2023-09-03 at 7 02 29 PM

however when i use the shortcode


{{< tabs "tab-group-name" >}}

{{< tab "first" >}}
First Tab
{{< /tab >}}

{{< tab "second" >}}
Second Tab content
{{< /tab >}}

{{< tab "third" >}}
Third Tab
{{< /tab >}}

{{< /tabs >}}

i get this error

failed to extract shortcode: shortcode "tabs" does not evaluate .Inner or .InnerDeindent, yet a closing tag was provided

any idea what i'm doing wrong?

Tab group does not work

Tabs with the same group Id do not change at the same time.

With the example below, switching tab from first (First Tab 1) to second (Second Tab 1) on the first tabs block does not change the same on the second tabs block: from first (First Tab 2) to second (Second Tab 2).

{{< tabs "tab-group-name" >}}
{{< tab "first" >}}
First Tab 1
{{< /tab >}}

{{< tab "second" >}}
Second Tab 1
{{< /tab >}}

{{< tab "third" >}}
Third Tab 1
{{< /tab >}}
{{< /tabs >}}


{{< tabs "tab-group-name" >}}
{{< tab "first" >}}
First Tab 2
{{< /tab >}}

{{< tab "second" >}}
Second Tab 2
{{< /tab >}}

{{< tab "third" >}}
Third Tab 2
{{< /tab >}}
{{< /tabs >}}

Multiple search matches display incorrect excerpt

When search string has several matches, the lastWord variable always contains the initial match's content. For example, let's assume the search string is "te" and we have the following content with two matches (caps for clarity):

"laTEr they go their separaTE ways"

"separate" becomes "separaLAte" in the search result excerpt, as matchIndex will always point to the first match, but the replace function replaces every occurrence because of the "g" (global) regex modifier:

return matchedContent.replace(
regex,
(match) => lastWord + `<mark>${match}</mark>`

As a workaround, I used a regex without the "global" flag in that block of code. Now it just highlights the first occurrence which is fine by me, but there might be a better solution.

          return matchedContent.replace(
            new RegExp(searchString, "i"),
            (match) => lastWord + `<mark>${match}</mark>`
          );

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.