The world’s fastest framework for building websites.

Overview

Hugo

A Fast and Flexible Static Site Generator built with love by bep, spf13 and friends in Go.

Website | Forum | Documentation | Installation Guide | Contribution Guide | Twitter

GoDoc Tests on Linux, MacOS and Windows Go Report Card

Overview

Hugo is a static HTML and CSS website generator written in Go. It is optimized for speed, ease of use, and configurability. Hugo takes a directory with content and templates and renders them into a full HTML website.

Hugo relies on Markdown files with front matter for metadata, and you can run Hugo from any directory. This works well for shared hosts and other systems where you don’t have a privileged account.

Hugo renders a typical website of moderate size in a fraction of a second. A good rule of thumb is that each piece of content renders in around 1 millisecond.

Hugo is designed to work well for any kind of website including blogs, tumbles, and docs.

Supported Architectures

Currently, we provide pre-built Hugo binaries for Windows, Linux, FreeBSD, NetBSD, DragonFly BSD, Open BSD, macOS (Darwin), and Android for x64, i386 and ARM architectures.

Hugo may also be compiled from source wherever the Go compiler tool chain can run, e.g. for other operating systems including Plan 9 and Solaris.

Complete documentation is available at Hugo Documentation.

Choose How to Install

If you want to use Hugo as your site generator, simply install the Hugo binaries. The Hugo binaries have no external dependencies.

To contribute to the Hugo source code or documentation, you should fork the Hugo GitHub project and clone it to your local machine.

Finally, you can install the Hugo source code with go, build the binaries yourself, and run Hugo that way. Building the binaries is an easy task for an experienced go getter.

Install Hugo as Your Site Generator (Binary Install)

Use the installation instructions in the Hugo documentation.

Build and Install the Binaries from Source (Advanced Install)

Prerequisite Tools

Fetch from GitHub

Since Hugo 0.48, Hugo uses the Go Modules support built into Go 1.11 to build. The easiest is to clone Hugo in a directory outside of GOPATH, as in the following example:

mkdir $HOME/src
cd $HOME/src
git clone https://github.com/gohugoio/hugo.git
cd hugo
go install

If you are a Windows user, substitute the $HOME environment variable above with %USERPROFILE%.

If you want to compile with Sass/SCSS support use --tags extended and make sure CGO_ENABLED=1 is set in your go environment. If you don't want to have CGO enabled, you may use the following command to temporarily enable CGO only for hugo compilation:

CGO_ENABLED=1 go install --tags extended

The Hugo Documentation

The Hugo documentation now lives in its own repository, see https://github.com/gohugoio/hugoDocs. But we do keep a version of that documentation as a git subtree in this repository. To build the sub folder /docs as a Hugo site, you need to clone this repo:

git clone [email protected]:gohugoio/hugo.git

Contributing to Hugo

For a complete guide to contributing to Hugo, see the Contribution Guide.

We welcome contributions to Hugo of any kind including documentation, themes, organization, tutorials, blog posts, bug reports, issues, feature requests, feature implementations, pull requests, answering questions on the forum, helping to manage issues, etc.

The Hugo community and maintainers are very active and helpful, and the project benefits greatly from this activity.

Asking Support Questions

We have an active discussion forum where users and developers can ask questions. Please don't use the GitHub issue tracker to ask questions.

Reporting Issues

If you believe you have found a defect in Hugo or its documentation, use the GitHub issue tracker to report the problem to the Hugo maintainers. If you're not sure if it's a bug or not, start by asking in the discussion forum. When reporting the issue, please provide the version of Hugo in use (hugo version).

Submitting Patches

The Hugo project welcomes all contributors and contributions regardless of skill or experience level. If you are interested in helping with the project, we will help you with your contribution. Hugo is a very active project with many contributions happening daily.

We want to create the best possible product for our users and the best contribution experience for our developers, we have a set of guidelines which ensure that all contributions are acceptable. The guidelines are not intended as a filter or barrier to participation. If you are unfamiliar with the contribution process, the Hugo team will help you and teach you how to bring your contribution in accordance with the guidelines.

For a complete guide to contributing code to Hugo, see the Contribution Guide.

Analytics

Dependencies

Hugo stands on the shoulder of many great open source libraries, in lexical order:

Dependency License
github.com/alecthomas/chroma MIT License
github.com/armon/go-radix MIT License
github.com/aws/aws-sdk-go Apache License 2.0
github.com/bep/debounce MIT License
github.com/bep/gitmap MIT License
github.com/bep/golibsass MIT License
github.com/bep/tmc MIT License
github.com/BurntSushi/locker The Unlicense
github.com/BurntSushi/toml MIT License
github.com/cpuguy83/go-md2man MIT License
github.com/danwakefield/fnmatch BSD 2-Clause "Simplified" License
github.com/disintegration/gift MIT License
github.com/dustin/go-humanize MIT License
github.com/fsnotify/fsnotify BSD 3-Clause "New" or "Revised" License
github.com/gobwas/glob MIT License
github.com/gorilla/websocket BSD 2-Clause "Simplified" License
github.com/hashicorp/golang-lru Mozilla Public License 2.0
github.com/hashicorp/hcl Mozilla Public License 2.0
github.com/jdkato/prose MIT License
github.com/kr/pretty MIT License
github.com/kyokomi/emoji MIT License
github.com/magiconair/properties BSD 2-Clause "Simplified" License
github.com/markbates/inflect MIT License
github.com/mattn/go-isatty MIT License
github.com/mattn/go-runewidth MIT License
github.com/miekg/mmark Simplified BSD License
github.com/mitchellh/hashstructure MIT License
github.com/mitchellh/mapstructure MIT License
github.com/muesli/smartcrop MIT License
github.com/nicksnyder/go-i18n MIT License
github.com/niklasfasching/go-org MIT License
github.com/olekukonko/tablewriter MIT License
github.com/pelletier/go-toml MIT License
github.com/pkg/errors BSD 2-Clause "Simplified" License
github.com/PuerkitoBio/purell BSD 3-Clause "New" or "Revised" License
github.com/PuerkitoBio/urlesc BSD 3-Clause "New" or "Revised" License
github.com/rogpeppe/go-internal BSD 3-Clause "New" or "Revised" License
github.com/russross/blackfriday Simplified BSD License
github.com/rwcarlsen/goexif BSD 2-Clause "Simplified" License
github.com/spf13/afero Apache License 2.0
github.com/spf13/cast MIT License
github.com/spf13/cobra Apache License 2.0
github.com/spf13/fsync MIT License
github.com/spf13/jwalterweatherman MIT License
github.com/spf13/pflag BSD 3-Clause "New" or "Revised" License
github.com/spf13/viper MIT License
github.com/tdewolff/minify MIT License
github.com/tdewolff/parse MIT License
github.com/yuin/goldmark MIT License
github.com/yuin/goldmark-highlighting MIT License
go.opencensus.io Apache License 2.0
go.uber.org/atomic MIT License
gocloud.dev Apache License 2.0
golang.org/x/image BSD 3-Clause "New" or "Revised" License
golang.org/x/net BSD 3-Clause "New" or "Revised" License
golang.org/x/oauth2 BSD 3-Clause "New" or "Revised" License
golang.org/x/sync BSD 3-Clause "New" or "Revised" License
golang.org/x/sys BSD 3-Clause "New" or "Revised" License
golang.org/x/text BSD 3-Clause "New" or "Revised" License
golang.org/x/xerrors BSD 3-Clause "New" or "Revised" License
google.golang.org/api BSD 3-Clause "New" or "Revised" License
google.golang.org/genproto Apache License 2.0
gopkg.in/ini.v1 Apache License 2.0
gopkg.in/yaml.v2 Apache License 2.0
Comments
  • Native Multilingual support in Hugo.

    Native Multilingual support in Hugo.

    The goal is to:

    • have support to write content/post/whatever.en.md to /en/2015/12/22/whatever/index.html
    • do the same with whatever.fr.md into /fr/2015/12/22
    • enable or disable with the "Multilingual" switch in the config
    • support having language switchers in templates, that know where the translated page is (with .Page.Translations) (when you're on /en/about/, there's a "Francais" link that points to /fr/a-propos)

    Missing:

    • example usage of the .Page.Translations feature.
    • shortcode or function to do i18n of strings, without resorting to: {{ ( index $.Site.Data.translations $.Site.Params.locale ).topslogan }}
      • I'd like it to be based on data / JSON / YAML, but use a convention.
      • https://github.com/nicksnyder/go-i18n seems like a good candidate to do server-side translation if we want all the bells and whistles of a translation engine.. Has tooling to build translation workflows too.
    • how to run it with two configs (one for each language), yet having something that writes the root "index.html" and redirect to something that either considers the users' browser, or has a fixed language redirection.

    This is basic code to open up a discussion as to how best we could handle that.

    I was thinking of exposing more Translations functionalities directly in the .Site, to crawl through one set of pages (instead of looping through all Pages, even though some are duplicated). Something like BaseLanguagePages ? and all those Page would have pointers to their translations.

    We could run the generation once for each language, and each time generating a /fr, or /en subtree.. consistent in itself.. and knowing about "the other side" of translations (through .Page.Translations). In that case, maybe Site.Pages could have only those of the current translation, but .Page.Translations would know of the others.. that might simplify menu generation and all, as it would never need to know about other translations, unless explicitly asked to.

    So @spf13, what do you think of all that ?

    Enhancement 
    opened by abourget 93
  • Standardize author data

    Standardize author data

    Here's the first attempt at standardizing Hugo author details.

    1. Data lives in /data/authors with one file per author. I thought about nesting it in /data/site/authors or /data/hugo/authors, but those seemed unnecessarily hidden.
    2. Author front matter is an array to support multiple authors, though it will be up to themes to support multiple authors or not. There is a convenience .Author method to return a single author. if there are multiple authors and this is used, there is no guarantee which author will be returned
    3. I changed .Site.Author from map[string]interface{} to Author, though I don't know if that is in use outside of the embedded RSS feed
    4. Social data should only be the username
    5. For Author social details, I added a .URL() convenience method that returns canonical urls for major social networks
    6. I added a params section to the author, though as of right now it is map[string]string instead of map[string]interface{}
    7. I use snake_case in the data files but templates will access them with PascalCase
    8. Here's a sample author file
    given_name      = "Derek"
    family_name     = "Perkins"
    display_name    = "Derek Perkins"
    thumbnail       = "img link"
    image           = "img link"
    short_bio       = "super short bio"
    bio             = "Here's Derek's awesome bio"
    email           = "[email protected]"
    
    [social]
        facebook    = "derekperkins"
        github      = "derekperkins"
        twitter     = "derek_perkins"
        googleplus  = "DerekPerkins1"
    
    [params]
       random       = "whatever you want"
    
    NeedsTriage Stale 
    opened by derekperkins 79
  • Upgrade the license to an open one

    Upgrade the license to an open one

    I realize you probably picked deliberately, but I will ask anyway. :-)

    For personal use the license is fine, but it would be nicer if the software had a properly open license (apache, bsd or MIT for example) for "corporate use". It's not about not contributing back, but just the added legal hassle using contagious licenses in anything.

    Enhancement Outdated 
    opened by abh 78
  • The big assets handling / resource transformation funcs naming thread

    The big assets handling / resource transformation funcs naming thread

    This is related to #4429 and #4381 but put in its own thread to get the attention it deserves.

    | Current Name | What is it| | --- | --- | | resources.Get ✅ | Creates a new Resource object given a path to a file in /assets (configurable). This also works for images that you can then scale. Anything with a MIME type recognized by Hugo (and you can define your own if you want). | | resources.GetMatch | Same as resources.Get, but uses pattern matching to find the first match.| | resources.Match | Create a slice of Resource objects matching the given pattern. See resources.Concat for a function that could use this. | | resources.ToCSS ✅ | Transform a Resource to CSS based on the source MIME type. In the first version, we will support SCSS. An implementation note here is that we will persist the result of this transformation, so if you later run this from a non-SASS-enabled Hugo, it will still work. When we finally get some proper plugin support in Hugo, these resource transformations will be candidates to queue up and send to external processors. | | resources.PostCSS ✅| See #4858 | | resources.Minify ✅ | Minifies the given Resource based on the source MIME type. Currently supports css, js, json, html, svg, xml. It will get a new RelPermalink and Permalink, e.g. /css/main.min.css. | | resources.Fingerprint ✅ | Creates a fingerprinted version of the given Resource; it will get a new RelPermalink and Permalink, e.g. /css/main.eae6b4ebececc2bbd7490966a5e01bcc.css. It defaults to sha256, but you can pass either md5, sha256or sha512 as an argument. | | Integrity ✅ | Available as .Data.Integrity on fingerprinted resources. See https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity. Note that if you want the Integrity, but don't care about the fingerprinting (aka cache-busting part), you can just apply the fingerprint function, and just use .Data.Integrity (i.e. not use RelPermalink etc.) | | resources.Concat ✅ | Concatenates a list of Resource objects. Think of this as a poor man's bundler. | | resources.ExecuteAsTemplate ✅| Parses and executes the given Resource and data context (e.g. .Site) as a Go template. Use your imagination for use cases for this one :-) | | resources.FromString ✅| Create a Resource from a string. |

    All of the above can be chained. So you can do {{ (resources.Resource "styles.scss" | resources.ToCSS | resource.Minify | resources.FingerPrint).RelPermalink }} etc.

    Note that I'm not sure that all of the above will arrive in the next Hugo version, but most of these are cheap to implement once the "resource chain" infrastructure is in place.

    So I want your input on the above. And note that most of these requires a Resource object to work. You may like or hate that term, but it's there. Which is a reason I have put all of these funcs into the resources namespace.

    Stale Proposal Outdated 
    opened by bep 74
  • Improve Hugo Internal vs GDPR

    Improve Hugo Internal vs GDPR

    Following the discussion at the forum: https://discourse.gohugo.io/t/hugo-vs-the-general-data-protection-regulations-gdpr-in-eu-eea/11526/12

    I will focus on the Google Analytics internal template in this first post. But feel free to add suggestions about other templates such as Disqus, Twitter etc

    Google Analytics

    Notes

    1. The following suggestions are for Analytics.js that is used in the current internal template

    2. For Google Tag Manager things are more complicated and the user needs to set various settings directly in the Google Analytics dashboard. I'm not using Google Tag Manager myself and I cannot help with it.

    3. I am not some expert these suggestions are my own research and feel free to build on them to help @bep build the internal templates that will make Hugo offer GDPR compliant websites out of the box.


    The general idea I am proposing is to make the Hugo GA internal template not collect any personally identifiable information so that it falls outside the scope of the GDPR. With such settings a Hugo site admin will not need user opt-in for Google Analytics cookies because no such cookies will be installed on a user's device. However as you may have guessed this will severely limit GA reporting. Namely no returning visitors etc. Also the owner of a GA property should have the User ID, Google Data Sharing and Advertising features disabled on their dashboard.

    Note Enabling any of the above features or using the default Google Analytics code as is in the Hugo internal template requires user opt-in on the frontend. The tricky part is that you will need to have Google Analytics disabled until the user agrees to it. I am not going to cover this scenario here.

    The key settings that need to change in the internal template are: Anonymize IP The GDPR treats IPs as personally identifiable information so the following should be enabled in the tracking code: ga('set', 'anonymizeIp', true); reference

    Disable Cookies and Use Session Storage to Store the Client ID Session Storage is for the duration of a user's visit on a website. Even the Client ID is treated as Personally Identifiable Information in some quarters. There is no consensus about this currently. See a blog post about this here

    var GA_SESSION_STORAGE_KEY = 'ga:clientId';
    if (window.sessionStorage) {
      ga('create', 'UA-XXXXX-Y', {
        'storage': 'none',
        'clientId': sessionStorage.getItem(GA_SESSION_STORAGE_KEY)
      });
      ga(function(tracker) {
        sessionStorage.setItem(GA_SESSION_STORAGE_KEY, tracker.get('clientId'));
      });
    }
    else {
      ga('create', 'UA-XXXXX-Y', 'auto');
    }
    ga('send', 'pageview');
    

    The above is a modified version of Google's sample code for using Local Storage to store the Client ID.

    However Local Storage is persistent until cleared by the user and as such a Hugo site admin would still need user opt-in as Local Storage is treated the same as cookies.

    There are caveats with the above setup below is the disclaimer by Google in the above page I linked to:

    Note: unlike cookies, localStorage is bound by the same-origin policy. If parts of your site are on different subdomains, or if some pages use http and others pages use https, you cannot use localStorage to track users between those pages. For this reason, cookies continues to be the officially recommended way to store the Client ID.

    Basically what the GDPR does is to limit Data Collection to the bare minimum. A setup as the one I propose above would make the Hugo GA internal template GDPR compliant but at the expense of GA reporting.

    It's up to the community to decide how to go about this.

    opened by onedrawingperday 66
  • Allow theme = [

    Allow theme = ["base", "my-theme" ] (aka theme composition and inheritance)

    I know this has been requested before, in the form of some extends = some-other-theme.

    This isn't "theme inheritance" in its purest form (which would be "theme1 extends theme2 extends theme3"), more like theme composition. Which is much simpler to understand/implement, but with most of the added benefits.

    This relates to my work on https://github.com/bep/html5up-to-hugo -- which, with the current Hugo, becomes less elegant than it could be.

    The simple rule is that the themes' files will form a big overlay/union file system from left to right.

    So:

    theme = ["base", "my-theme" ]
    
    • All files in base will be used unless there is a file with the same name in my-theme.
    • This will work with layouts, data, i18n, static (and in the future: content etc.)

    What do you say?

    Enhancement Keep Outdated 
    opened by bep 65
  • Add Content Bags

    Add Content Bags

    This issue has been discussed before: #3462 etc.

    • A content folder is identified as a bundle if it contains either a _index.* or a index.* file.
    • For index.* files (i.e. single content pages) type of bundles, the bundle will also include any sub folders (i.e. images etc.).

    Thinking in Go terms, we add a new Resource type (a Page is a Resource):

    interface Resource {
       Permalink() string
       RelPermalink() string
    }
    
    • $funnyCatsPage.Pages => [even-more-content.md, more-content.md]
    • $funnyCatsPage.Resources => [even-more-content.md, more-content.md, cat.jpg, another-cat.jpg]
    • $funnyCatsPage.Resources.ByType "image" => [cat.jpg, another-cat.jpg]
    • The sub-content-pages will not have Permalink, i.e they will not be rendered to disk on its own, but will typically be used to compose the "bag page".

    A Page is a Resource, but we will need others, one example would be Image, which would have some additional image related properties, such as Width and Height, but also methods to generate alternate versions of that image:

    $cat := $funnyCatsPage.GetResource "image" "cat.jpg"
    $scaled := $cat.Scale "1000x600"
    
    <img src="{{ $scaled.Permalink }}" width={{ $scaled.Width }} height={{ $scaled.Height }}>
    

    The API above is just an example. But I think this "processing only when needed" will scale better than, say, create 5 different version of every image, even if only a small fraction is in actual use.

    NOTE: This proposal is about how the bags in Hugo should look like at its core -- it is not about details in a future image scaling APIs etc. The only way to get this done is to define a fairly narrow scope.

    TODO: Permalinking, ...

    Related

    • Galleries
    • Image cropping, resizing and compression, see #3207 etc.
    • Resource linking in markdown (with cropping, resizing etc.)
    • ??
    Enhancement Outdated 
    opened by bep 60
  • Shortcode output wrapped in <p> tags under certain conditions

    Shortcode output wrapped in

    tags under certain conditions

    Previous related issue 'Shortcode output wrapped in <p> tags' #1148 which was closed with 004fcdd.

    Consistent incorrect wrapping of shortcode output under certain conditions

    Reported in discuss forum here.

    Salient points:

    1. If there is just one shortcode, it doesn't get wrapped in <p> tags

    2. If there are multiple shortcodes, the first doesn't get wrapped in <p> tags (probably related to above)

    3. In order to ensure no shortcodes are wrapped in <p> tags, the final shortcode must be followed by a number of distinct <p> tag wrapped lines proportionate to the number of shortcodes in the document.

    By that I mean if you have say 6 shortcodes one after the other, you need 16 lines following them in order for none to be wrapped in <p> tags. If you have 5 shortcodes one after the other you need 12 lines.

    1. 'Lines following shortcode' don't have to come at the end of the document, if you have a series of shortcodes it seems the number of interceeding <p> tag wrapped lines are cumulatively ranked towards each consecutive shortcode so if you had 30 lines interspaced between shortcodes throughout the document, as long as each shortcode has at least 5 proceeding lines each, they'll all be spared wrapping.

    2. Related to point 4, the <p> tags that get wrapped around shortcodes incorrectly also count towards the number of <p> tag wrapped lines needed to follow preceeding shortcodes - so enough shortcodes in a row and you seem to be about to start unwrapping some of the 'first' few in the list.

    3. Length of shortcode title attribute also affects whether output wrapped in <p> tags though this has not been investigated in detail

    NOTE - I may have miss counted the exact number of lines in between shortcodes, my eyes were actually bleeding...

    Keep Outdated 
    opened by josharcheruk 59
  • Manual testing of Hugo 0.55 (Help Wanted!)

    Manual testing of Hugo 0.55 (Help Wanted!)

    See:

    • The notes in https://github.com/gohugoio/hugo/issues/5681
    • The solved issues in https://github.com/gohugoio/hugo/milestone/87?closed=1
    • It may also help to look at the open issues: https://github.com/gohugoio/hugo/milestone/87

    The important bits of that release is now implemented and merged to master.

    I have tested this extensively manually myself, but I would really appreciate that you if you know how to compile Hugo from source, can take this for a spin on your site.

    It's cool if you also test the "new stuff", but I'm mostly curious about if this somehow breaks anything in your site. And if it somehow breaks for you, access to the source code so I could see how and what would be gold. I'm not looking for more feature requests (as in "it would be cool if that also ...") as this has already been one of the most work-intensive releases.

    I would strongly recommend that you build with the latest Go 1.12.1.

    Outdated 
    opened by bep 53
  • Add an option to trim trailing slashes from URLs

    Add an option to trim trailing slashes from URLs

    It lives behind a trimTrailingSlash option in config.toml. There is no CLI flag for this option.

    It works by hooking into the uglyURLs functionality and then stripping out the .html suffix when generating URLs. This means it generates /filename.html files rather than /filename/index.html. It also handles when there's no trailing slash in the page's URL when set through the front matter.

    It's all been tested, but if there are any I've missed please let me know.

    I've documented the option in my fork of hugoDocs. I'll create a PR if/when this progresses.

    See #3556 and https://discuss.gohugo.io/t/links-without-a-trailing-slash/831.

    Keep 
    opened by jamieconnolly 49
  • Add Custom Output Formats to Hugo

    Add Custom Output Formats to Hugo

    See https://github.com/bep/hugo/blob/custom-output/docs/content/extras/custom-output-types.md


    Also see #2828 Also see https://discuss.gohugo.io/t/custom-output-content-types/4584

    InProgress 
    opened by bep 49
  • Problem if the url parameter of a page contains a dot

    Problem if the url parameter of a page contains a dot

    What version of Hugo are you using (hugo version)?

    $ hugo version
    hugo v0.107.0-DEV-85e2ac1a4424fdde673b663c37043ece61212f0c+extended linux/amd64 BuildDate=2022-11-21T08:42:40Z
    

    Does this issue reproduce with the latest release?

    yes

    If i have a post, which has the parameter url set, and this url contains a ".", hugo does not generate the usual folder structure ($url instead of $url/index.html).

    E.g.

    $ grep url content/post/logseq-v0.8.9-and-namespaces.md 
    url: logseq-v0.8.9-and-namespaces
    

    generates the output file with no file ending and no folder/index.html:

    $ ll testpublic/logseq-v0.8.9-and-namespaces 
    -rw-r--r-- 1 strubbl strubbl 7.9K Nov 22 23:01 testpublic/logseq-v0.8.9-and-namespaces
    

    Changing the post to have no dots in the url parameter:

    $ grep url content/post/logseq-v0.8.9-and-namespaces.md 
    url: logseq-v0-8-9-and-namespaces
    

    generates the usual output:

    $ ll testpublic/logseq-v0-8-9-and-namespaces
    total 8.0K
    -rw-r--r-- 1 strubbl strubbl 7.9K Nov 22 23:29 index.html
    

    My expectation would be, that when using dots in the url, the output would be:

    $ ll testpublic/logseq-v0.8.9-and-namespaces
    total 8.0K
    -rw-r--r-- 1 strubbl strubbl 7.9K Nov 22 23:29 index.html
    
    Bug NeedsTriage 
    opened by Strubbl 0
  • Add $page.RenderContent

    Add $page.RenderContent

    There is a similar issue in here somewhere, which stranded mostly because of ... naming. I'm deliberately not referring to that issue here, I suspect this needs a fresh approach.

    type Page interface {
     RenderString(args ...any) (template.HTML, error)
     RenderContent(opts ...any) (Content, error)
    }
    

    I think I like the above:

    • It doesn't conflict with the existing .Content method (which we obviously need to keep)
    • It matches RenderString and it signals an action.

    The opts can probably be used for many things, but my first idea was to use it to solve a common problem with no current good solution in Hugo: {{ .Content }} will return the exactly the same whether rendered from a single or a list template. This is very performant, but thee are some situations where this is not ideal.

    So, I thought we could start by introducing a variant option, e.g:

    {{ $renderedContent := $somepage.RenderContent (dict "variant" "list") }}
    

    Or something.

    The $renderedContent above would be a struct with the common fields, and then probably some:

    type Content struct {
      Content []byte
      WordCount int
     }
    

    And and some table of contents things.

    Proposal 
    opened by bep 0
  • [Feature Request] Add support for Cloudflare Web Analytics

    [Feature Request] Add support for Cloudflare Web Analytics

    Feature Request:

    Duplicate of https://github.com/gohugoio/hugo/issues/8482 , which got prematurely auto closed by the github bot. Can we please have a direct integration with Cloudflare Analytics in Hugo, just like the existing support for Google Analytics: https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/google_analytics_async.html ?

    Cloudflare analytics are privacy preserving and non-obtrusive form of analytics for static websites.

    NeedsTriage Proposal EmbeddedTemplate 
    opened by ashutoshsaboo 0
  • Consider to make sure append always copies the input slice

    Consider to make sure append always copies the input slice

    Go's append (and reflect.Append) reuses the input slice if there is enough capacity, else it creates a new one and copies the content over.

    The reason we have not seen this bug before is probably

    1. Because in most common cases where you use append you're working on a local slice and the current behaviour makes sense.
    2. append is used on slices returned from where etc.
    3. append is called enough elements so the capacity needs to be expanded.

    Note that the other collection funcs (where, union etc.) always creates a new slice.

    See https://discourse.gohugo.io/t/appending-a-page-to-a-page-collection-append-or-union/41532/10

    Bug 
    opened by bep 1
  • common/htime: add `:date_time`, `:date_only`, `:time_only`

    common/htime: add `:date_time`, `:date_only`, `:time_only`

    This PR adds :date_time ("2006-01-02 15:04:05"), :date_only ("2006-01-02"), :time_only ("15:04:05") to the custom layouts.

    Those are popular layouts and will be added to golang's time pkg as well.

    Reference: https://github.com/golang/go/commit/0981d9fff1fa5601a2b7833473955252425bd923

    opened by Umio-Yasuno 2
Releases(v0.107.0)
Owner
GoHugo.io
A Fast and Flexible Static Site Generator built with love in GoLang
GoHugo.io
Crane - 🐦 A full-text WebAssembley search engine for static websites

Crane ?? My blog post: WebAssembly Search Tools for Static Sites Crane is a technical demo is inspired by Stork and uses a near-identical configuratio

Andrew Healey 37 Nov 20, 2022
A golang script designed to output the cert information for various websites

gofer gofer is a golang script designed to output the cert information for various websites Example run You can supply multiple sites with port (ie. :

Nick Anderson 2 Jun 15, 2022
Golang/Gin codebase containing real world examples that adheres to the RealWorld spec and API.

Golang/Gin codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld spec and API. This codebase was

null 0 Dec 3, 2021
The cider is a simple tool of building GitHub pages. It's fast and easy to use.

The cider is a simple tool of building GitHub pages. It's fast and easy to use. See example: https://www.leyafo.com Install Compiling from source code

李亚夫 49 Feb 13, 2022
Go-web-scaffold - A simple scaffold for building web app quickly

Go-web-scaffold A simple scaffold for building web app quickly. features This sc

Statrue 3 Jan 21, 2022
An easy, fluent way of building URLs via chainable methods written in Go(lang)

Burl - a fluent URL builder Burl provides an easy, fluent way of building URLs via chainable methods. How to install go get github.com/mr-cryka/burl Q

Daniel Krajka 0 Feb 5, 2022
Jump start with the golang, start building fast REST or GraphQL API's

personalized overview and instruction for everyday use golang projects and language structure.

Mainul Dip 0 Feb 7, 2022
GoCondor is a golang web framework with an MVC like architecture, it's based on Gin framework

GoCondor is a golang web framework with an MVC like architecture, it's based on Gin framework, it features a simple organized directory structure for your next project with a pleasant development experience, made for developing modern APIs and microservices.

Go Condor 37 Sep 12, 2022
[爬虫框架 (golang)] An awesome Go concurrent Crawler(spider) framework. The crawler is flexible and modular. It can be expanded to an Individualized crawler easily or you can use the default crawl components only.

go_spider A crawler of vertical communities achieved by GOLANG. Latest stable Release: Version 1.2 (Sep 23, 2014). QQ群号:337344607 Features Concurrent

胡聪 1.8k Dec 2, 2022
A golang framework helps gopher to build a data visualization and admin panel in ten minutes

the missing golang data admin panel builder tool. Documentation | 中文介绍 | DEMO | 中文DEMO | Twitter | Forum Inspired by laravel-admin Preface GoAdmin is

GoAdmin 6.5k Nov 28, 2022
Example golang using gin framework everything you need, i create this tutorial special for beginner.

Golang Gin Framework Fundamental Example golang using gin framework everything you need, i create this tutorial special for beginner. Feature Containe

Restu Wahyu Saputra 82 Nov 22, 2022
A restful api's with Gin Framework with a structured project that defaults to PostgreSQL database

Welcome to Golang Gin boilerplate v2 The fastest way to deploy a restful api's with Gin Framework with a structured project that defaults to PostgreSQ

Dominik Dario 0 Oct 15, 2021
Simple web app using Go and Gin framework

go-gin-app Simple web app using Go and Gin framework Golang 과 Gin 프레임워크를 사용한 간단한 웹 앱 How to get Started Install Gin and have Go installed on your syst

Sean Hong(홍성민) 0 Oct 18, 2021
Golang beego framework based personal simple blog system

goblog 基于Golang的个人简易博客系统 [TOC] goblog介绍 goblog基于go语言开发的一个简约版个人博客系统,基于Golang语言编写,后端基于了Beego的web框架,目前具备博文系统最基础的功能模块.基本上是一个拿来即用的个人博文平台,只需要部署一个mysql数据存储服务

Mr.Qin 2 Nov 9, 2021
A fully functional Ecommerce API in GO GIN Framework and mongoDB with JWT Authentication

Fully functional ECOMMERCE API USING GIN FRAMEWORK AND MONGODB -----Initial Release v2.30 ⚠️ Not tested the efficiency project structure Ecommerce ??

Joseph Hermis 19 Aug 24, 2022
Menggunakan gol ver 1.13.15 dan framework gin dan gorm

Menggunakan gol ver 1.13.15 dan framework gin dan gorm

Faqih Yugo Susilo 6 Jul 11, 2022
Restful API example with using go and gin framework

simple device api Simple Device API is really simple and concise to show how easy to implement a Restful Service with using Golang. It uses gin framew

Mustafa Soyvural 0 Nov 18, 2021
A simple blog based on gin framework

gin-blog 介绍 a simple blog based on gin framework 软件架构 MySQL/MariaDB as database 安装教程 基于Docker启动MySQL/MariaDB 使用说明 启动MySQL in Docker. 参与贡献 Fork 本仓库 新建

jimmyyem 0 Nov 15, 2021
Go (Golang) API REST with Gin FrameworkGo (Golang) API REST with Gin Framework

go-rest-api-aml-service Go (Golang) API REST with Gin Framework 1. Project Description Build REST APIs to support AML service with the support of exte

Tony Aizize 1 Nov 21, 2021