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/target
AgeCommit message (Collapse)Author
2016-10-15Implement support for alias templatesNate Finch
This change adds a canonical alias.html template that is used for page redirects, and passes the page as data to the template under .Page Fixes #2533 Closes #2576
2016-09-06Redirect to main language from rootBjørn Erik Pedersen
See #2312 See #2309
2016-06-09Update the alias generated HTML files to conform to the W3C HTML specMarvin Pinto
- W3C recommends that there be a [whitespace character][1] between the `;` and the `url=` portions. - W3C also recommends that there be a [title][2] child in the `head` element [1]: https://www.w3.org/TR/html-markup/meta.http-equiv.refresh.html [2]: https://www.w3.org/TR/html-markup/head.html Closes #1933
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-23target: Fix some Golint warningsBjørn Erik Pedersen
2016-03-14target: Remove unused codeBjørn Erik Pedersen
2015-12-11Add copyright header to that source files that don’t have one.Anthony Fok
See #1646
2015-11-23Permalink on Node and Page should be of stringKato Kazuyoshi
This change fixes #1384.
2015-09-14Add "control code" and "trailing space" to alias validationAnthony Fok
2015-09-13Validate aliases to prevent directory traversal etc.Anthony Fok
Add validation before creating aliases: * Prevent creating aliases outside webroot (public/ dir) * Skip empty "" alias * Skip "/" → "/index.html", which gets overwritten anyway * Refuse to create Windows-invalid filenames on Windows; warn on other platforms * In case of invalid aliases, after skipping them, return `err = nil` to prevent the error passing up all the way to `hugolib.Render()` and causing Hugo to abort. * Update alias tests. Fixes #701: Add support for alias with whitespace Fixes #1418: Add validation for alias
2015-06-11Make sure target destination has the right path separator.David Calavera
Signed-off-by: David Calavera <david.calavera@gmail.com>
2015-05-16Add support for URLs relative to context rootbep
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
2015-05-14Only uglify 404.html on server rootbep
`404.html` needs to be that and not `/404/` in the root. There seem to be content pages in the wild with the name `404` (Hugo docs), so this commit adds an extra check so only root 404 pages ignore the `uglifyURLs`setting. Fixes #1140
2015-03-18More initialism corrections (golint)Anthony Fok
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.
2015-03-11Correct initialisms as suggested by golintAnthony Fok
First step to use initialisms that golint suggests, for example: Line 116: func GetHtmlRenderer should be GetHTMLRenderer as see on http://goreportcard.com/report/spf13/hugo Thanks to @bep for the idea! Note that command-line flags (cobra and pflag) as well as struct fields like .BaseUrl and .Url that are used in Go HTML templates need more work to maintain backward-compatibility, and thus are NOT yet dealt with in this commit. First step in fixing #959.
2015-03-07Handle 404 thread safelybep
Replaces hack that temporarily changes a global flag. Fixes #955 Fixes #939
2014-12-09Fix various Windows-issuesbep
File handling was broken on Windows. This commit contains a revision of the path handling with separation of file paths and urls where needed. There may be remaining issues and there may be better ways to do this, but it is easier to start that refactoring job with a set of passing tests. Fixes #687 Fixes #660
2014-11-14converted path 2 filepathJoel Scoble
2014-11-04New targets & new renderers and write methods [WIP]spf13
2014-11-01Migrating Hugo to Afero for filesystem calls.spf13
2014-05-01moving writeToDisk to helpers to make it more accessiblespf13
2014-02-05Add unicode support for aliases, indexes, urlize template filter.Anton Ageev
Now aliases and indexes are not restricted ASCII letters and can include any unicode letters.
2013-12-05Reorganize helpersspf13
2013-12-03Create directories in publishdir with mode 0777.David Arroyo
The previous permissions (0764), were unusable (directories must be executable) when generating files for use by another uid. The Right Thing™ is to use mode 0777. The OS will subtract the process umask (usually 022) to the for the final permissions. Signed-off-by: Noah Campbell <noahcampbell@gmail.com>
2013-10-08Code cleanupNoah Campbell
2013-10-08Move in memory target into target module.Noah Campbell
2013-09-25Support index.html indexes in content directoryNoah Campbell
If a file named index.html exists in a directory, or root, it will be rendered as if ugly urls are turned on. This allows for top level content to not need a supporting layout file and content in content. This change should not affect anyone who is using the perscribed way. I also cleaned up a bunch of one off functions in site.go.
2013-09-21Section is determined by the source, not the urlNoah Campbell
This change allows for top level html content to exists.
2013-09-14Add /index.html to unadorned alias pathsNoah Campbell
Bring code to be better in line with documentation.
2013-09-13Move alias logic to target moduleNoah Campbell
I want to move all logic to writing aliases to target so I can pave the way for writing aliases specific to other runtimes (like .htaccess for apache or a script for updating AWS or symlinking on a filesystem).
2013-09-13Move alias rendering to targetNoah Campbell
2013-09-12Normalize paths within hugoNoah Campbell
filepath was used inconsistently throughout the hugolib. With the introduction of source and target modules, all path are normalized to "/". This simplifies the processing of paths. It does mean that contributors need to be aware of using path/filepath in any module other than source or target is not recommended. The current exception is hugolib/config.go
2013-09-05Homepage "/" respects PublishDirNoah Campbell
It wasn't taking the value of PublishDir into consideration for the special case of the homepage "/". Fixes #75
2013-09-05Introduce source.FilesystemNoah Campbell
This provides an abstraction over how files are processed by Hugo. This allows for alternatives like CMS systems or Dropbox, etc.
2013-09-04Expand the ShowPlan functionalityNoah Campbell
2013-09-04Move to target.FilesystemNoah Campbell
Moving the ugly urls logic to the target. There is still UglyUrl logic in page for the permlink but this is dealing with the generate of urls.
2013-09-04Add Translate to targetNoah Campbell
Translate handles Ugly Urls.
2013-08-31Externalize the writing of content to a targetNoah Campbell
Introducing the target module in hugo. This provides the simple interface for writing content given a label (filename) and a io.Reader containing the content to be written. If site.Target is not set, it defaults back to the original behavior of writing to file system. In hugolib/site_url_test.go I have an InMemoryTarget for testing purposes and use it to see if the final output of a render matches.