summaryrefslogtreecommitdiffstats
path: root/helpers/path.go
Commit message (Collapse)AuthorAge
...
* Replace some leftover os.Stat with hugofs.SourceBjørn Erik Pedersen2016-09-11
|
* Handle symlink change eventBjørn Erik Pedersen2016-09-11
| | | | | | | | | | | | | | | | | | | | | | | | | | Hugo 0.16 announced support for symbolic links for the root folders, /content, /static etc., but this got broken pretty fast. The main problem this commit tries to solve is the matching of file change events to "what changed". An example: ContentDir: /mysites/site/content where /mysites/site/content is a symlink to /mycontent /mycontent: /mypost1.md /post/mypost2.md * A change to mypost1.md (on OS X) will trigger a file change event with name "/mycontent/mypost1.md" * A change to mypost2.md gives event with name "/mysites/site/content/mypost2.md" The first change will not trigger a correct update of Hugo before this commit. This commit fixes this by doing a two-step check: 1. Check if "/mysites/site/content/mypost2.md" is within /mysites/site/content 2. Check if "/mysites/site/content/mypost2.md" is within the real path that /mysites/site/content points to Fixes #2265 Closes #2273
* Add multilingual support in HugoAlexandre Bourget2016-09-06
| | | | | | | | | | | | | | | | | | | | | | | | | 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..
* Return specific error on walk path too shortBjørn Erik Pedersen2016-07-30
|
* Adjust the sanity check to path length 4Bjørn Erik Pedersen2016-07-30
|
* Add sanity check to the file walkerBjørn Erik Pedersen2016-07-30
| | | | | As more tests now hit the virtual filesystem, add this check to prevent any walking of the entire file system.
* Do not return empty theme dirsBjørn Erik Pedersen2016-07-30
| | | | | | This prevents reading data etc. from the root. Fixes #2320
* Handle errors during filesystem walkBjørn Erik Pedersen2016-07-30
| | | | Fixes #2318
* Fix panic when using URLizeMathias Biilmann2016-07-11
| | | Using URLize on a string like '100%-true' would cause a panic
* Fix error handling in SymbolicWalkBjørn Erik Pedersen2016-03-25
|
* helpers: Fix SymbolicWalk for the root folderBjørn Erik Pedersen2016-03-25
| | | | | | | | handle the root folders themselves. This commit fixes that. Fixes #2018
* helpers: Fix and add Godoc in path*Bjørn Erik Pedersen2016-03-23
|
* helpers: Remove the else in MakePathSanitizedBjørn Erik Pedersen2016-03-23
|
* Add support for symbolic links for content, layout, static, themeBjørn Erik Pedersen2016-03-21
| | | | | | Note: This is for the content roots only, but that should satisfy most needs. Fixes #1855
* Add '+' as one of the valid characters in urls specified in the front matterAditya Bhargava2016-03-21
| | | | Fixes #1290
* Simplify GetDottedRelativePathBjørn Erik Pedersen2016-03-19
|
* helpers: Remove unused codeBjørn Erik Pedersen2016-03-14
|
* Add support for Go 1.6 block keyword in templatesBjørn Erik Pedersen2016-03-10
| | | | | | NOTE: Needs Go 1.6 to use the new feature. Fixes #1832
* Add themesDir option to configurationdigitalcraftsman2016-01-01
| | | | | | | themesDir can be used to change the default path of the themes folder. Fixes 1556
* Fixes #1292Daniel TISCHER2016-01-01
|
* Fix hugo server "Watching for changes" path displayAnthony Fok2015-12-19
| | | | | | | | | | | especially when the given `--source` path is a relative directory. Also, when `--source` is specified, make WorkingDir an absolute path from the very beginning, to be consistent with the case when `--source` is not given. Otherwise, the function name helpers.AbsPathify(), which prepends WorkingDir to a relative path, does not really make sense. Fixes #1721
* move some of the path helper utilities to aferoSteve Francia2015-12-08
| | | | and provide wrappers in Hugo.
* Fix copyright headers in source filesBjørn Erik Pedersen2015-12-07
| | | | | | Still need to add some missing headers and an AUTHORS file. See #1646
* Change the license to Apache 2.0Steve Francia2015-11-23
|
* Simplify ExtractRootPathsBjørn Erik Pedersen2015-11-23
|
* Improve "watching for ..." loggingBjørn Erik Pedersen2015-11-23
|
* Preserve Unicode marks in MakePathBjørn Erik Pedersen2015-10-18
| | | | Fixes #1488
* Rename prettiyPath to prettifyPathBjørn Erik Pedersen2015-10-15
|
* Unexport internal path helperBjørn Erik Pedersen2015-10-14
|
* Add config option "disablePathToLower"chrongzhang2015-09-01
| | | | | | Enabling this prevents lowercasing of the path/url. Fixes #557
* Unexport FileAndExtBjørn Erik Pedersen2015-08-26
| | | | If needed outside helpers, create an exported file path (FilePathAndExt?) and/or a url version.
* Revert "Fix some Go code doc issues"Bjørn Erik Pedersen2015-08-07
| | | | | | This reverts commit de7dd70bbc1ac533f137e5f788e1b337d6ba6b8c. Broke the code fence feat.
* Fix some Go code doc issuesBjørn Erik Pedersen2015-08-06
|
* Refactor theme path helper functions.Jonathan Anderson2015-06-25
| | | | | Reduce duplication (`x + FilePathSeparator + y` a few lines away from `filepath.Join(x, y)`) and add a `GetThemeDir()` function to get the current theme's directory. Also add a comment complaining about the `GetThemesDirPath()` function, which doesn't seem to do what its name would suggest. This might be a candidate for deprecation?
* Remove superfluous returnBjørn Erik Pedersen2015-06-16
|
* Make removal of accents in taxonomy and section paths optionalBjørn Erik Pedersen2015-06-16
| | | | | | And default off. Fixes #1180
* Remove accents in URLsbep2015-05-31
| | | | | | | | | | So the taxonomy `Gérard Depardieu` gives paths on the form `gerard-depardieu`. Unfortunately this introduces two imports from the `golang.org/`, but Unicode-normalization isn't something we'd want to write from scratch. See https://blog.golang.org/normalization See #1180
* Support `Fish and Chips` sectionbep2015-05-28
| | | | | | | | | | | | | | | Section names are also used as the title of the list pages, but naming section folders as `Fish and Chips` and similar didn't work very well. This commit fixes that. This commit also changes the title casing of the section titles. Some may argue that this is a breaking change, but the old behaviour was also pretty broken, even for languages that use title capitalizations, as it didn't follow any particular style guide, `fish and chips` became `Fish And Chips` etc. Now it just turns the first letter into upper case, so `Fish and Chips` will be left as `Fish and Chips`. People wanting the good old behaviour can use the `title` template func. Fixes #1176
* Never remove trailing slash in RelPermalinkbep2015-05-27
| | | | Fixed #1174
* Unexport filepath/path bridge typesbep2015-05-25
| | | | | | They are of no use outside the helpers package. See #1160
* Add support for URLs relative to context rootbep2015-05-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting `RelativeURLs` to `true` will make all relative URLs in the site *really* relative. And will do so with speed. So: In `/post/myblogpost.html`: `/mycss.css` becomes `../mycss.css` The same in `/index.html` will become: `./mycss.css` etc. Note that absolute URLs will not be touched (either external resources, or URLs constructed with `BaseURL`). The speediness is about the same as before: ``` benchmark old ns/op new ns/op delta BenchmarkAbsURL 17462 18164 +4.02% BenchmarkAbsURLSrcset 18842 19632 +4.19% BenchmarkXMLAbsURLSrcset 18643 19313 +3.59% BenchmarkXMLAbsURL 9283 9656 +4.02% benchmark old allocs new allocs delta BenchmarkAbsURL 24 28 +16.67% BenchmarkAbsURLSrcset 29 32 +10.34% BenchmarkXMLAbsURLSrcset 27 30 +11.11% BenchmarkXMLAbsURL 12 14 +16.67% benchmark old bytes new bytes delta BenchmarkAbsURL 3154 3404 +7.93% BenchmarkAbsURLSrcset 2376 2573 +8.29% BenchmarkXMLAbsURLSrcset 2569 2763 +7.55% BenchmarkXMLAbsURL 1888 1998 +5.83% ``` Fixes #1104 Fixes #622 Fixes #937 Fixes #157
* Make page 1 alias uglybep2015-05-10
| | | | | | When `uglyurls = true` Fixes #1121
* List directories being watched when server is runDylan MacKenzie2015-04-02
| | | | | | | | | | | | | | Fixes part of issue 1030. Previously hugo only listed the content directory as being watched. Now we list all files being watched according to `commands.getDirList()`. We also introduce a RemoveSubpaths function and test in the helpers module to reduce noise in the command line output by not showing subdirectories of ones already being watched. For example, instead of: `Watching for changes in $HOME/blog/content` We get: `Watching for changes in $HOME/blog/{data,content,layouts,static,themes/my-theme}`
* Handle views in combo with Ace base templatesbep2015-03-29
| | | | | | | | | | | | | | | | | | | | As views looks like a regular template, but doesn't need a base template, we have to look inside it. Altough really not needed by this commit, reading the full file content into memory just to do a substring search is a waste. So this commit implements a `ReaderContains` func that in most cases should be much faster than doing an `ioutil.ReadAll` and `bytes.Contains`: ``` benchmark old ns/op new ns/op delta BenchmarkReaderContains 78452 20260 -74.18% benchmark old allocs new allocs delta BenchmarkReaderContains 46 20 -56.52% benchmark old bytes new bytes delta BenchmarkReaderContains 46496 1258 -97.29% ``` Fixes #999
* More initialism corrections (golint)Anthony Fok2015-03-18
| | | | | | | | | | | | | | | | | | | | | Thanks to @bep's new, brilliant helpers.Deprecated() function, the following functions or variables are transitioned to their new names, preserving backward compatibility for v0.14 and warning the user of upcoming obsolescence in v0.15: * .Url → .URL (for node, menu and paginator) * .Site.BaseUrl → .Site.BaseURL * .Site.Indexes → .Site.Taxonomies * .Site.Recent → .Site.Pages * getJson → getJSON * getCsv → getCSV * safeHtml → safeHTML * safeCss → safeCSS * safeUrl → safeURL Also fix related initialisms in strings and comments. Continued effort in fixing #959.
* helpers: apply some Golint rulesbep2015-03-07
|
* Add trailing file separator to temp dirCyrill Schumacher2015-02-19
| | | | | | | | Make sure that the file separator is added to the temp dir in all cases. This prevents cache temp files being written to the root temp folder. Fixes #910
* Fix bug on windows where the backslash got removed in func MakePath()Cyrill Schumacher2015-02-17
|
* Merge to stay up to date with current devCyrill Schumacher2015-02-17
| | | | | Feature: GetJson and GetJson in short codes or other layout files. For more details please see: http://cyrillschumacher.com/2014/12/21/dynamic-pages-with-gohugo.io/
* Add data files support in themesbep2015-02-11
| | | | | | If duplicate keys, the main data dir wins. Fixes #892