davidsneighbour / hugo-modules Goto Github PK
View Code? Open in Web Editor NEWA mono repo for all GoHugo modules by @davidsneighbour.
Home Page: https://github.com/davidsneighbour/hugo-modules
License: MIT License
A mono repo for all GoHugo modules by @davidsneighbour.
Home Page: https://github.com/davidsneighbour/hugo-modules
License: MIT License
Some HTML validators complain about <meta http-equiv="x-dns-prefetch-control" content="on/off">
which is not false per se, but better located in the headers of a page than on the page itself. Moving it out will remove those false errors and keep the feature alive. It's also a "forbidden header", meaning it must not be changed during it's lifetime. Moving it out of the scope of any JS will help with that.
Move the evaluation of the parameters into the shortcode or template, then run, based on global config or local type parameter a layout file that receives a specified object (dict) to create a gallery based on the "types" requirement. currently we have bootstrap 4 and 5 implemented with not much config parameters for prev/next nav and such things.
This modules figure
shortcode overrides the GoHugo internal shortcode figure
.
figure
shortcode can do more with link to the docsSee https://www.netlifycms.org/docs/add-to-your-site/#installing-with-npm
Currently the ahrefs check complains about the feed links having language attributes that all point to the same language. Find out how to properly mark up these links without them being marked as translations.
Also: shouldn't they be listed only on the home page?
Entries currently come up without article images. Add an image tag to the templates.
Having an HTML string in a variable will lead to it being parsed into the debugging table instead of displayed as HTML string.
Sample:
{{ partial "debugprint" .NextPage }}
will render the link to the next page instead of displaying the HTML but should display the type and the string itself.
It would be nice to have a hook return values (or a value). Depending on the hookname (ret-hookname
?) the hook could execute the linked layout and return a value or multiple values.
{{ $returnedvalue := partial "func/hooks" "hookname" }}
One main issue is, how to tell func/hooks that a return value is expected and if it's safe enough to just pipe through what the template returns.
Adding [[redirect]]
sections to the data configuration is not working. The redirects don't work on Netlify. Need to investigate if they are in _redirects
or not.
dnb-org/dnb-hugo-netlification was moved to davidsneighbour/hugo-netlification. This change will introduce some issues for projects using this module. The proper path (wooden mallet method) to update the project is as follows:
sudo rm -rf /tmp/hugo_cache/
, this path will vary depending on your system. This step might not be required.modules
section of your config and change all occurrences of dnb-org/dnb-hugo-netlification
to davidsneighbour/hugo-netlification
. Or change all occurrences of dnb-org/dnb-
to davidsneighbour/
if you use multiple modules by ex-dnb-org.go.sum
.require ()
in go.mod
.hugo mod get -u ./...
to update go.mod
and recreate go.sum
.Some options are not required, but available. Try to add them somehow to the system without enforcing them.
see https://developer.mozilla.org/en-US/docs/Web/Manifest/background_color
The idea is to set the resizing strategy via front matter cascade per section. On kollitsch.dev images look skewed now, because the strategy was set to resize, which shamelessly stretches weird image sizes. Better be .Fit
by default and .Resize
via front matter or something like that. Right now it looks "sucky".
There seem to be issues with .Fit
and cutting off things around the image, but it seems to be a better fit for the overall design... or .Resize
with only a width?
See title
Is your feature request related to a problem? Please describe.
Hooks map onto files with the same name as the hook (and its cached variant). For instance, taking the head-start
hook from the Best Practice
list, the hook will load:
But there can only be a single file implementing that hook as a result, which means that the hook implementation is custom to a site or theme and not really pluggable.
Describe the solution you'd like
What if we would change this to work with folders? Taking the same head-start
hook, resolving this hook would load all files in this folder(s):
More than one Hugo module could then contribute snippets to the same hook.
For backwards compatibility, we could still resolve the files (current implementation) as a last resort.
Describe alternatives you've considered
Making a "clone" of your hugo-hooks
, but I rather bundle forces instead of creating my own hugo-hooks
variant.
Additional context
I use hugo-netlification
. If we would implement folders as hooks
, the netlification module could be updated to provide the snippets placed in the correct folder(s):
After adding the hugo-netlification
module to my site, only the netlification configuration is required separately. Files are already at the correct place for inclusion.
Litetube works only if it's concatenated to a script, not via require or import. Change that.
Make debug-partial notices silenceable via slug, as opposed to setting the level of verbosity for all messages of this level to disappear
This seems to be undocumented and the feature also needs a decision matrix when to use what setting.
If an image in a gallery has a different height then the whole page flickers when a smaller height is displayed. make the gallery div the maximum size of all images displayed.
Add robot tags and configuration. This probably is already somehow configurable via dnb-hugo-robots and/or dnb-hugo-sitemap
This allows users to configure their own content type setup.
WordPress filter feature for GoHugo basically. Hand data to a filter(-hook) partial and if a filter partial exists for that filter term then run the data through it and return whats returned or the data unchanged.
See for instance https://codepen.io/huphtur/pen/mNbGeb - add parameters for the svg tag:
Add a global scratch that collects debugging output and then show where the developer adds an output partial.
This can be done with a debug parameter. Collecting data over the page and then in the footer show everything collected.
We have hooks that execute and print code in our templates. How about having some form of pluggable truth giving variables.
Sample:
in the config:
[truther]
some.parameter.name = false
in the layout:
{{ with (site.Params.some.parameter.name | default true) }}
do something
{{ end }}
Sure, this could be on a per template/theme base, but with a reusable system this could be used to enable/disable date display, comment forms on a global or even local (frontmatter params) level and reuse documentation for these settings.
The executing code could be some form of
{{ if partial "truths.html" (dict
"variable" "some.parameter.name"
"value" "local value"
"default" true) }}
do something
{{ end }}
and the partial could take care of sanitisation, comments in the CLI output, collection of available settings, etc.
As described in Advanced Usage a custom theme can be added. Let's implement it here too.
The setup would be as follows:
[outputs]
home = ["GISCUS_THEME"]
[params.dnb.giscus]
theme = "dark"
[params.dnb.giscus.theme]
stylesheet = "scss/giscus/theme.scss"
colorPrettylightsSyntaxComment = "#768390"
colorPrettylightsSyntaxConstant = "#6cb6ff"
...
stylesheet
is a path to a stylesheet (looks by default for assets/scss/giscus/theme.scss
). This stylesheet will import the original theme selected under giscus
(loading via getRemote), then subsequent properties under theme
are added as overrides and exports the finished stylesheet.
The camelcased syntax of the theme variables are corresponding to the CSS variables in the sample theme.
The pain point here is how to map this without having to add all items to the template. I think there should be a way to transform camelcase to title-case in Hugo.
Currently I think it's a sequence like this:
If GISCUS_THEME
is set in the outputs, then a custom stylesheet will be linked, so a custom theme without any settings in the theme
config section still can add custom styles via theme.scss
.
Currently the canonical link is set on EVERY page, which is not required. It makes sense to add canonical only to pages that have multiple URLs (including forwards) that they can be reached at.
With the current (new, but wrong) way of adding the label and description of debugging types to the configuration file we can't translate it easily, so changing it around to the following method:
i18n/en.toml
for the defaultslabel-$slug
and description-$slug
connects to the type configurations slug
parameterThis will lead to three locations that new formatters need to be added to, config, i18n and formatter layouts. I wonder if it's possible to encapsule all parts in a single config file per formatter?
Add a scratch that collects hooks to be printed with dnb-org/debug so we can see what hooks a theme implements.
Gitlab pages uses the same format for HEADERS and REDIRECTS files (maybe a different name). Cloudflare has a similar feature. Write up docs how to use netlification for these services.
The default formatter (catches types the component does not know) throws a warning at the moment that it does not know type x
. This should be extended into a nice preconfigured system that enables a quick notification to create a new formatter.
Each formatter requires
Current formatters to do:
It appears that the context is delivered sometimes as "context" sub items of . and sometimes as . itself.
currently everything in site.Params.dnb.pwa
is printed into the manifest file. This should be filtered against a list of available options and sanitized.
see also #53
Author tag generation is quite simple done still, but the plan is a bit more explicit, maybe even an external module for authors:
see also https://discourse.gohugo.io/t/site-author-usage/31459/11
The author section of the config is relatively un-regulated, so the following structure is what I will attempt to build in:
authors
-frontmatter with at least name
and a fitting site.data.authors.author.name
parameterauthors
-frontmatter with at least name
in a subarray of one or more authors[author]
config section with at least one sub-array[author]
config section with at least name
parameterAdd a way to make the <base>
tag configurable. Currently it is set to baseURL
but that doesn't make much sense in many cases. For instance ![](local image path) won't work with that.
Add a parameter globally and locally to set the baseURL and add a parameter to set a method of what content the base tag should use (local permalink or baseurl).
Keep an eye on this issue and integrate the debugging functions (or, if it turns out as I understand it might, deprecate the debug partial or modify to be a formatted debugging option).
The PostCSS processing is failing currently and disabled. There needs to be a check if postcss is configured (check for file postcss.config.js?) and if so it runs.
site.Params
✔️
[params.dnb.social]
[params.dnb.social.sharebuttons]
icons = true
sharetext = true
networks = ["facebook", "twitter", "linkedin"]
networks
configuration ✔️Add a template file to a hook via for instance:
[[dnb.hooks]]
hookname: templatepath
This can be used by plugins to add hooks without them being overridden by local hook files.
Add options object with parameters to:
See https://gohugo.io/functions/hugo/#hugodeps and add a graph for Deps.
{{- partial "func/pictures/getArticleImage.html" $page $cache_id -}}
will return the article image for the given context ($page
) as a resource object or an empty dictionary. This function might become resource-intensive without the most common (low number) settings, so use it cautiously and cached. $cache_id
should be the page object (untested).
Returns immediately on any successful hit starting with method 1; not checked boxes mark features that are not implemented yet in the current version.
header.*
in a leaf bundleheaderimage
assets/
, thenstatic/
andtags
, then keywords
frontmatter and
params
mainimage
set to true
(if multiple items exist, then the first one is used)use_resource
with false
.[params.dnb.pictures] > default_headerimage
and
assets/
static/
assets
, then it will be preprocessed and return a responsive picture
tagstatic
, then it will be inserted as is or per configuration (see below)the page object for which to extract the image.
dictionary with
Create a custom .htaccess file from header/redirects configuration.
Move all debugging ability by default to the development environment and add a variable that enforces debugging in the production environment (or any other environment existing).
This module should not debug on live sites.
Currently the debugprint partial evaluates the following check to determine if the variable is a slice:
which doesn't cover variables built by slice "bla"
(it would print only the "bla"
part without indicator, see davidsneighbour/hugo-debug#69.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.