aboutsummaryrefslogtreecommitdiffhomepage
path: root/source
AgeCommit message (Collapse)Author
2017-12-27:sparkles: Implement Page bundling and image handlingBjørn Erik Pedersen
This commit is not the smallest in Hugo's history. Some hightlights include: * Page bundles (for complete articles, keeping images and content together etc.). * Bundled images can be processed in as many versions/sizes as you need with the three methods `Resize`, `Fill` and `Fit`. * Processed images are cached inside `resources/_gen/images` (default) in your project. * Symbolic links (both files and dirs) are now allowed anywhere inside /content * A new table based build summary * The "Total in nn ms" now reports the total including the handling of the files inside /static. So if it now reports more than you're used to, it is just **more real** and probably faster than before (see below). A site building benchmark run compared to `v0.31.1` shows that this should be slightly faster and use less memory: ```bash ▶ ./benchSite.sh "TOML,num_langs=.*,num_root_sections=5,num_pages=(500|1000),tags_per_page=5,shortcodes,render" benchmark old ns/op new ns/op delta BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4 101785785 78067944 -23.30% BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4 185481057 149159919 -19.58% BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4 103149918 85679409 -16.94% BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4 203515478 169208775 -16.86% benchmark old allocs new allocs delta BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4 532464 391539 -26.47% BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4 1056549 772702 -26.87% BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4 555974 406630 -26.86% BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4 1086545 789922 -27.30% benchmark old bytes new bytes delta BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4 53243246 43598155 -18.12% BenchmarkSiteBuilding/TOML,num_langs=1,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4 105811617 86087116 -18.64% BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=500,tags_per_page=5,shortcodes,render-4 54558852 44545097 -18.35% BenchmarkSiteBuilding/TOML,num_langs=3,num_root_sections=5,num_pages=1000,tags_per_page=5,shortcodes,render-4 106903858 86978413 -18.64% ``` Fixes #3651 Closes #3158 Fixes #1014 Closes #2021 Fixes #1240 Updates #3757
2017-11-19source: Enable disabled testBjørn Erik Pedersen
2017-11-17Add support for multiple staticDirsBjørn Erik Pedersen
This commit adds support for multiple statDirs both on the global and language level. A simple `config.toml` example: ```bash staticDir = ["static1", "static2"] [languages] [languages.no] staticDir = ["staticDir_override", "static_no"] baseURL = "https://example.no" languageName = "Norsk" weight = 1 title = "På norsk" [languages.en] staticDir2 = "static_en" baseURL = "https://example.com" languageName = "English" weight = 2 title = "In English" ``` In the above, with no theme used: the English site will get its static files as a union of "static1", "static2" and "static_en". On file duplicates, the right-most version will win. the Norwegian site will get its static files as a union of "staticDir_override" and "static_no". This commit also concludes the Multihost support in #4027. Fixes #36 Closes #4027
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-09source: Normalize UniqueID between Windows & LinuxMatthieu Harlé
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-06-13Run gofmt to get imports in line vs gohugoio/hugoBjørn Erik Pedersen
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-06-07Revert "hugolib: Fix live-reload regression for add/removal of dirs"Bjørn Erik Pedersen
Never mind. The "adding dir" scenario didn't work anyway, so that will need another fix. This reverts commit 49a104309d53af243b32443a59bdc2a6fc9beeef. Closes ##3325
2017-06-07hugolib: Fix live-reload regression for add/removal of dirsBjørn Erik Pedersen
This reverts commit b5b6e81c0269abf9b0f4bc6a127744a25344e5c6. That change breaks watching of new directories (new dirs, deleted dirs). Reopens #3325 Fixes #3569
2017-05-30source: Cache language configBjørn Erik Pedersen
``` benchmark old ns/op new ns/op delta BenchmarkSiteBuilding/frontmatter=YAML|num_root_sections=1|num_pages=5000|tags_per_page=0|shortcodes=false|render=false-4 552742744 501838152 -9.21% benchmark old allocs new allocs delta BenchmarkSiteBuilding/frontmatter=YAML|num_root_sections=1|num_pages=5000|tags_per_page=0|shortcodes=false|render=false-4 3047393 2957378 -2.95% benchmark old bytes new bytes delta BenchmarkSiteBuilding/frontmatter=YAML|num_root_sections=1|num_pages=5000|tags_per_page=0|shortcodes=false|render=false-4 356533864 354291924 -0.63% ```
2017-04-22hugolib: Ignore non-source files on partial rebuildxofyarg
Partial rebuild does not have the same logic as normal rebuild on selecting which file to build. This change makes it possible to share the file select logic between two kinds of build. Fix #3325.
2017-02-17all: Refactor to nonglobal Viper, i18n etc.Bjørn Erik Pedersen
This is a final rewrite that removes all the global state in Hugo, which also enables the use if `t.Parallel` in tests. Updates #2701 Fixes #3016
2017-02-04all: Refactor to nonglobal file systemsBjørn Erik Pedersen
Updates #2701 Fixes #2951
2016-12-31docs, tpl: Fix documentation of UniqueIDdigitalcraftsman
See #2861
2016-12-31source: Make UniqueID ... uniqueBjørn Erik Pedersen
Fixes #2861
2016-11-23hugolib, source, tpl: Fix docsbogem
See #2014
2016-11-23helpers: Rename WalkRootTooShortError to ErrWalkRootTooShortbogem
Fix golint warning: helpers/path.go:473:5: error var WalkRootTooShortError should have name of the form ErrFoo See #2014
2016-11-22commands, hugolib, source, target, tpl: Get rid of some fmt statementsbogem
2016-11-15source, tpl: Fix staticcheck complaintsAlbert Nigmatzianov
tpl/template_funcs.go:1019:3: the surrounding loop is unconditionally terminated source/lazy_file_reader.go:66:5: err != nil is always true for all possible values ([nil:error] != [nil:error])
2016-11-01Fix page names that contain dotPrashant Karmakar
changes: - in hugolib/page.go, `func permalink` and `func TargetPath` Fixed the attempt to *replace* the extension of something that was *already* a basename. - in source/file.go, `func NewFile` added check for allowed languages before translating filename Fixes #2555
2016-10-28Make it clear that Path is relative to content rootBjørn Erik Pedersen
Fixes #2290
2016-10-24all: Unify case of config variable namesAlbert Nigmatzianov
All config variables starts with low-case and uses camelCase. If there is abbreviation at the beginning of the name, the whole abbreviation will be written in low-case. If there is abbreviation at the end of the name, the whole abbreviation will be written in upper-case. For example, rssURI.
2016-09-11Replace some leftover os.Stat with hugofs.SourceBjørn Erik Pedersen
2016-09-06Multilingual TODO-fixes, take 1Bjørn Erik Pedersen
See #2309
2016-09-06Optimize the multilanguage build processBjørn Erik Pedersen
Work In Progress! This commit makes a rework of the build and rebuild process to better suit a multi-site setup. This also includes a complete overhaul of the site tests. Previous these were a messy mix that were testing just small parts of the build chain, some of it testing code-paths not even used in "real life". Now all tests that depends on a built site follows the same and real production code path. See #2309 Closes #2211 Closes #477 Closes #1744
2016-09-06Add multilingual support in HugoAlexandre Bourget
Implements: * support to render: * content/post/whatever.en.md to /en/2015/12/22/whatever/index.html * content/post/whatever.fr.md to /fr/2015/12/22/whatever/index.html * gets enabled when `Multilingual:` is specified in config. * support having language switchers in templates, that know where the translated page is (with .Page.Translations) (when you're on /en/about/, you can have a "Francais" link pointing to /fr/a-propos/) * all translations are in the `.Page.Translations` map, including the current one. * easily tweak themes to support Multilingual mode * renders in a single swift, no need for two config files. Adds a couple of variables useful for multilingual sites Adds documentation (content/multilingual.md) Added language prefixing for all URL generation/permalinking see in the code base. Implements i18n. Leverages the great github.com/nicksnyder/go-i18n lib.. thanks Nick. * Adds "i18n" and "T" template functions..
2016-08-08source: Normalize file name to NFCKishin Yagami
Fixes #2203
2016-07-30Use the Afero source fs where relevantBjørn Erik Pedersen
Fixes #2319
2016-07-30Make LazyFileReader use the Afero source fsBjørn Erik Pedersen
Fixes #2317
2016-07-11Ignore emacs temp filesAlexandre Bourget
2016-06-25helpers: Remove ToReader funcsCameron Moore
Remove StringToReader and BytesToReader in favor of using the stdlib directly.
2016-04-07source: Add missing GoDoc in FileBjørn Erik Pedersen
See #2014
2016-03-31Add readFile template funcBjørn Erik Pedersen
This also includes a refactor of the hugofs package and its usage. The motivation for that is: The Afero filesystems are brilliant. Hugo's way of adding a dozen of global variables for the different filesystems was a mistake. In readFile (and also in some other places in Hugo today) we need a way to restrict the access inside the working dir. We could use ioutil.ReadFile and implement the path checking, checking the base path and the dots ("..") etc. But it is obviously better to use an Afero BasePathFs combined witha ReadOnlyFs. We could create a use-once-filesystem and handle the initialization ourselves, but since this is also useful to others and the initialization depends on some other global state (which would mean to create a new file system on every invocation), we might as well do it properly and encapsulate the predefined set of filesystems. This change also leads the way, if needed, to encapsulate the file systems in a struct, making it possible to have several file system sets in action at once (parallel multilanguage site building? With Moore's law and all...) Fixes #1551
2016-03-22source: Consolidate if conditionssrinivasreddy
2016-03-21Add support for symbolic links for content, layout, static, themeBjørn Erik Pedersen
Note: This is for the content roots only, but that should satisfy most needs. Fixes #1855
2016-03-17source: Consolidate filepath.Split callssrinivasreddy
2016-03-14source: Remove unused codeBjørn Erik Pedersen
2016-01-26Read/reread individual source content filesSteve Francia
next is incremental conversion
2016-01-05Update and refactor to ack Go AuthorsCameron Moore
2015-12-10Add copyright header to that source files that don’t have one.Anthony Fok
See #1646
2015-12-07Fix copyright headers in source filesBjørn Erik Pedersen
Still need to add some missing headers and an AUTHORS file. See #1646
2015-11-23Change the license to Apache 2.0Steve Francia
2015-08-22Use LazyFileReader for reading file contentsTatsushi Demachi
Simple ioutil.ReadFile is used for reading file contents but it reads all of the file contents and copies them into the memory and is run in a single goroutine. It causes much memory consumption at copying media files in content directory to publish directory and it is not good at performance. This improves the both issue by replacing ReadFile with LazyFileReader. It postpones reading the file contents until it is really needed. As the result, actual file read is run in parallelized goroutine. It improves performance especially in a really big site. In addition, if this reader is called from io.Copy, it does not copy the file contents into the memory but just copies them into destination file. It improves much memory consumption issue when the site has many media files. Fix #1181
2015-08-22Add LazyFileReader type to source libraryTatsushi Demachi
LazyFileReader is an io.Reader implementation to postpone reading the file contents until it is really needed. It is introduced for improving performance and memory consumption at reading media files in content directory.
2015-07-21source/File: Fix data racesBjørn Erik Pedersen
2015-06-03Add some tests for IgnoreFilesbep
And log error on invalid regexp. See #1189
2015-06-03Rename WatchIgnoreFiles to IgnoreFilesbep
Because this isn't just about server and watching. See #1189
2015-06-03Add configurable list to ignore files in server watchbep
The following inside `config.toml` will ignore files ending with `.foo` and `.boo`. ``` watchIgnoreFiles = [ "\\.foo$", "\\.boo$" ] ``` The above is is a list of Reqular Expressions, but note the escaping of the `\` to make TOML happy. Fixes #1189
2015-03-12source: add some test cases for Filebep