Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/gohugoio/hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/media
AgeCommit message (Collapse)Author
2022-04-28Some godoc adjustments and image struct renamesBjørn Erik Pedersen
2022-03-18all: gofmt -w -r 'interface{} -> any' .Bjørn Erik Pedersen
Updates #9687
2022-02-10Update the application/javascript media typeJoe Mooring
Add jsm and mjs extensions. Closes #9483
2021-12-22media: Also consider extension in FromContentBjørn Erik Pedersen
As used in `resources.GetRemote`. This will now reject image files with text and text files with images.
2021-12-22media: Add missing BMP and GIF to the default MediaTypes listBjørn Erik Pedersen
2021-12-22media: Add PDF MIME typeBjørn Erik Pedersen
2021-12-17Always use content to resolve content type in resources.GetRemoteBjørn Erik Pedersen
This is a security hardening measure; don't trust the URL extension or any `Content-Type`/`Content-Disposition` header on its own, always look at the file content using Go's `http.DetectContentType`. This commit also adds ttf and otf media type definitions to Hugo. Fixes #9302 Fixes #9301
2021-12-13Improve handling of remote image/jpeg resources (#9278)Joe Mooring
Add jpe, jif, and jfif to image/jpeg extensions. For remote image/jpeg without extension, always use jpg extension. Closes #9275
2021-12-03media: Add rss suffix for application/rss+xmlPaul van Brouwershaven
Closes #9233
2021-06-18media: Adjust test assertionBjørn Erik Pedersen
Closes #8625
2021-06-18media: support application/manifest+jsonRohan Kumar
The standard file extension for Web App Manifest files is ".webmanifest". This commit allows Hugo to recognize .webmanifest files as "application/manifest+json" files and to minify them using its JSON minifier. The .webmanifest file extension is recommended in the w3c spec to simplify media type registration: https://www.w3.org/TR/appmanifest/#media-type-registration Webhint docs are also relevant: https://webhint.io/docs/user-guide/hints/hint-manifest-file-extension/ Closes #8624
2021-06-14Misc config loading fixesBjørn Erik Pedersen
The main motivation behind this is simplicity and correctnes, but the new small config library is also faster: ``` BenchmarkDefaultConfigProvider/Viper-16 252418 4546 ns/op 2720 B/op 30 allocs/op BenchmarkDefaultConfigProvider/Custom-16 450756 2651 ns/op 1008 B/op 6 allocs/op ``` Fixes #8633 Fixes #8618 Fixes #8630 Updates #8591 Closes #6680 Closes #5192
2021-04-20Regression in media type suffix lookupBjørn Erik Pedersen
Introduced in Hugo 0.82.0. Fixes #8406
2021-04-15Add webp image encoding supportBjørn Erik Pedersen
Fixes #5924
2021-03-14media: Make Type comparableBjørn Erik Pedersen
So we can use it and output.Format as map key etc. This commit also fixes the media.Type implementation so it does not need to mutate itself to handle different suffixes for the same MIME type, e.g. jpg vs. jpeg. This means that there are no Suffix or FullSuffix on media.Type anymore. Fixes #8317 Fixes #8324
2021-03-11media: Add a basic benchmarkBjørn Erik Pedersen
2020-12-16all: Fix minor typosPhil Davis
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-07-22resources/js: Add option for setting bundle formatBjørn Erik Pedersen
Fixes #7503
2020-07-13Add proper Media Type handling in js.BuildBjørn Erik Pedersen
See #732
2020-03-20Some minify configuration adjustmentsBjørn Erik Pedersen
2019-12-19Fix incorrect MIME type from image/jpg to image/jpegJohn Zaitseff
According to multiple sources, both official ([IANA] and [RFC2046]) and otherwise (eg, [Mozilla] and [Wikipedia]), the official MIME type for JPEG images is `image/jpeg`, not `image/jpg`. Change Hugo to match. [IANA]: https://www.iana.org/assignments/media-types/media-types.xhtml#image [RFC2046]: https://tools.ietf.org/html/rfc2046 [Mozilla]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types [Wikipedia]: https://en.wikipedia.org/wiki/JPEG
2019-10-16media: Add common video media typesNicolas Martignoni
- See https://discourse.gohugo.io/t/resources-bytype-for-video-files/21285
2019-10-06media: Use + to create the Type stringBjørn Erik Pedersen
2019-09-21resources: Support output image format in image operationsJ. Ansorg
The image format is defined as the image extension of the known formats, excluding the dot. All of 'img.Resize "600x jpeg"', 'img.Resize "600x jpg"', and 'img.Resize "600x png"' are valid format definitions. If the target format is defined in the operation definition string, then the converted image will be stored in this format. Permalinks and media type are updated correspondingly. Unknown image extensions in the operation definition have not effect. See #6298
2019-08-12tests: Convert from testify to quicktestBjørn Erik Pedersen
2019-03-23Make Page an interfaceBjørn Erik Pedersen
The main motivation of this commit is to add a `page.Page` interface to replace the very file-oriented `hugolib.Page` struct. This is all a preparation step for issue #5074, "pages from other data sources". But this also fixes a set of annoying limitations, especially related to custom output formats, and shortcodes. Most notable changes: * The inner content of shortcodes using the `{{%` as the outer-most delimiter will now be sent to the content renderer, e.g. Blackfriday. This means that any markdown will partake in the global ToC and footnote context etc. * The Custom Output formats are now "fully virtualized". This removes many of the current limitations. * The taxonomy list type now has a reference to the `Page` object. This improves the taxonomy template `.Title` situation and make common template constructs much simpler. See #5074 Fixes #5763 Fixes #5758 Fixes #5090 Fixes #5204 Fixes #4695 Fixes #5607 Fixes #5707 Fixes #5719 Fixes #3113 Fixes #5706 Fixes #5767 Fixes #5723 Fixes #5769 Fixes #5770 Fixes #5771 Fixes #5759 Fixes #5776 Fixes #5777 Fixes #5778
2018-12-23tpl/transform: Add transform.Unmarshal funcBjørn Erik Pedersen
Fixes #5428
2018-09-07media: Fix golint issuesCameron Moore
Fix godoc issues and the following: media/mediaType.go:228:1: receiver name t should be consistent with previous receiver name m for Type
2018-08-28Improve minifier MIME type resolutionBjørn Erik Pedersen
This commit also removes the deprecated `Suffix` from MediaType. Now use `Suffixes` and put the MIME type suffix in the type, e.g. `application/svg+xml`. Fixes #5093
2018-07-11media: Only show deprecation warning when neededBjørn Erik Pedersen
Fixes #4927
2018-07-10media: Allow multiple file suffixes per media typeBjørn Erik Pedersen
Before this commit, `Suffix` on `MediaType` was used both to set a custom file suffix and as a way to augment the mediatype definition (what you see after the "+", e.g. "image/svg+xml"). This had its limitations. For one, it was only possible with one file extension per MIME type. Now you can specify multiple file suffixes using "suffixes", but you need to specify the full MIME type identifier: [mediaTypes] [mediaTypes."image/svg+xml"] suffixes = ["svg", "abc ] In most cases, it will be enough to just change: [mediaTypes] [mediaTypes."my/custom-mediatype"] suffix = "txt" To: [mediaTypes] [mediaTypes."my/custom-mediatype"] suffixes = ["txt"] Hugo will still respect values set in "suffix" if no value for "suffixes" is provided, but this will be removed in a future release. Note that you can still get the Media Type's suffix from a template: {{ $mediaType.Suffix }}. But this will now map to the MIME type filename. Fixes #4920
2018-07-06Add Hugo Piper with SCSS support and much moreBjørn Erik Pedersen
Before this commit, you would have to use page bundles to do image processing etc. in Hugo. This commit adds * A new `/assets` top-level project or theme dir (configurable via `assetDir`) * A new template func, `resources.Get` which can be used to "get a resource" that can be further processed. This means that you can now do this in your templates (or shortcodes): ```bash {{ $sunset := (resources.Get "images/sunset.jpg").Fill "300x200" }} ``` This also adds a new `extended` build tag that enables powerful SCSS/SASS support with source maps. To compile this from source, you will also need a C compiler installed: ``` HUGO_BUILD_TAGS=extended mage install ``` Note that you can use output of the SCSS processing later in a non-SCSSS-enabled Hugo. The `SCSS` processor is a _Resource transformation step_ and it can be chained with the many others in a pipeline: ```bash {{ $css := resources.Get "styles.scss" | resources.ToCSS | resources.PostCSS | resources.Minify | resources.Fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Digest }}" media="screen"> ``` The transformation funcs above have aliases, so it can be shortened to: ```bash {{ $css := resources.Get "styles.scss" | toCSS | postCSS | minify | fingerprint }} <link rel="stylesheet" href="{{ $styles.RelPermalink }}" integrity="{{ $styles.Data.Digest }}" media="screen"> ``` A quick tip would be to avoid the fingerprinting part, and possibly also the not-superfast `postCSS` when you're doing development, as it allows Hugo to be smarter about the rebuilding. Documentation will follow, but have a look at the demo repo in https://github.com/bep/hugo-sass-test New functions to create `Resource` objects: * `resources.Get` (see above) * `resources.FromString`: Create a Resource from a string. New `Resource` transformation funcs: * `resources.ToCSS`: Compile `SCSS` or `SASS` into `CSS`. * `resources.PostCSS`: Process your CSS with PostCSS. Config file support (project or theme or passed as an option). * `resources.Minify`: Currently supports `css`, `js`, `json`, `html`, `svg`, `xml`. * `resources.Fingerprint`: Creates a fingerprinted version of the given Resource with Subresource Integrity.. * `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. Fixes #4381 Fixes #4903 Fixes #4858
2017-09-29Clean up lint in various packagesCameron Moore
Changes fall into one of the following: - gofmt -s - receiver name is inconsistent - omit unused 2nd value from range - godoc comment formed incorrectly - err assigned and not used - if block ends with a return statement followed by else
2017-08-07all: Fix spellingBjørn Erik Pedersen
And some other minor issues.
2017-08-07all: gofmt -sBjørn Erik Pedersen
2017-08-03Add some missing doc commentsJorin Vogel
As pointed out by the linter, some exported functions and types are missing doc comments. The linter warnings have been reduced from 194 to 116. Not all missing comments have been added in this commit though.
2017-07-31media: Add missing JSON tags to TypeBjørn Erik Pedersen
See https://github.com/gohugoio/hugoDocs/issues/114
2017-07-31media: Add JSON tags to TypeBjørn Erik Pedersen
See https://github.com/gohugoio/hugoDocs/issues/114
2017-06-20media, hugolib: Support extension-less media typesBjørn Erik Pedersen
This change is motivated by Netlify's `_redirects` files, which is currently not possible to generate with Hugo. This commit adds a `Delimiter` field to media type, which defaults to ".", but can be blanked out. Fixes #3614
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-04-07all: Document the Output Formats featureBjørn Erik Pedersen
This commit also adds a new command, docshelper, with some utility funcs that adds a JSON datafiles to /docs/data that would be a pain to create and maintain by hand. Fixes #3242
2017-04-06media, output: Fix spellingBjørn Erik Pedersen
2017-04-04Register all media types when in server modeBjørn Erik Pedersen
Fixes #3274
2017-04-04media: Add DecodeTypesBjørn Erik Pedersen
And clean up the media package.
2017-04-04output: Add output formats decoderBjørn Erik Pedersen
And clean up the output package.
2017-04-01media, output: Add CSV type and formatBjørn Erik Pedersen
And make CSS correclty behave as plain text.
2017-03-28media: Add some more relevant MIME typesBjørn Erik Pedersen
2017-03-27media, output: Add Calendar typeBjørn Erik Pedersen
2017-03-27hugolib: Read default output formats from site configBjørn Erik Pedersen