summaryrefslogtreecommitdiffstats
path: root/hugolib/site_url_test.go
AgeCommit message (Collapse)Author
2017-06-13all: Update import paths to gohugoio/hugoBjørn Erik Pedersen
2017-06-08hugolib: Enable nested sectionsBjørn Erik Pedersen
Fixes #465
2017-04-07hubolib: Do not add missing trailing slash to command line baseURLBjørn Erik Pedersen
This makes it consistent with how it behaves when it's set in config.toml. This commit also unifies BaseURL in Site.Info so we now have one source for this value. Fixes #3262
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
2017-01-07all: Refactor to non-global loggerBjørn Erik Pedersen
Note that this looks like overkill for just the logger, and that is correct, but this will make sense once we start with the template handling etc. Updates #2701
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-10-13all: Remove dead codeAlbert
2016-09-06Improve language handling in URLsBjørn Erik Pedersen
The current "rendering language" is needed outside of Site. This commit moves the Language type to the helpers package, and then used to get correct correct language configuration in the markdownify template func. This commit also adds two new template funcs: relLangURL and absLangURL. 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-06Introduce HugoSites typeBjørn Erik Pedersen
And a Hugo global variable which contains the site under build. This is really needed to get some level of control of the "multiple languages" in play. There are still work related to this scattered around, but that will come. With this commit, the multilingual feature is starting to work.
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-19hugolib: Use named keys in composite literalsCameron Moore
Make `go vet` great again
2016-04-08hugolib: Un-export internal Site-methodsBjørn Erik Pedersen
These are obviously internal and for the most part undocumented, creating lots of GoLint warnings. See #1160 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-22hugolib: Fix Java-styled all-caps constsBjørn Erik Pedersen
2016-03-14hugolib: Remove unused codeBjørn Erik Pedersen
2016-03-09Create template clone for late template executionBjørn Erik Pedersen
Fixing some breaking blogs on Go 1.6 Fixes #1879
2015-12-10Add copyright header to that source files that don’t have one.Anthony Fok
See #1646
2015-05-20Stop Viper from leaking across many of the tests (now tests pass regardless ↵spf13
of order tested)
2015-05-05Do not add trailing slash to baseURLbep
Fixes #1105
2015-01-26Add pagination support for home page, sections and taxonomiesbep
Two new configuration properties, `Paginate` (default `0`) and `PaginatePath` (default `page`) are added. Setting `paginate` to a positive value will split the list pages for the home page, sections and taxonomies into chunks of size of the `paginate` property. A `.Paginator` is provided to help building a pager menu. There are two ways to configure a `.Paginator`: 1. The simplest way is just to call `.Paginator.Pages` from a template. It will contain the pages for "that page" (`.Data.Pages` will (like today) contain all the pages). 2. Select a sub-set of the pages with the available template functions and pass the slice to `.Paginate` : `{{ range (.Paginate (where .Data.Pages "Type" "post")).Pages }}` **NOTE:** For a given Node, it's one of the options above. It's perfectly legitimate to iterate over the same pager more than once, but it's static and cannot change. The `.Paginator` contains enough information to build a full-blown paginator interface. The pages are built on the form (note: BLANK means no value, i.e. home page): ``` [SECTION/TAXONOMY/BLANK]/index.html [SECTION/TAXONOMY/BLANK]/page/1/index.html => redirect to [SECTION/TAXONOMY/BLANK]/index.html [SECTION/TAXONOMY/BLANK]/page/2/index.html .... ``` Fixes #96
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-04Updating tests to use new Targets & Writers and switch to using ↵spf13
Afero.MemMapFs for more accurate tests.
2014-10-16Big refactor of how source files are used. Also added default destination ↵spf13
extension option.
2014-04-09Renamed Indexes to Taxonomies. Old template and config parameters still work.spf13
2014-04-07Fixing all tests to pass with new Viper Configspf13
2014-03-01Fixing issues go vet reports.Mike Keesey
2013-11-05Remove the hugo-nav functionNoah Campbell
Remove the hugo-nav since it relied on a slow library. The current build reimplements the absurl functionality based on string replace. Discovered that my prior implementation missed the requirement for making absolute paths (/path) absolute with the host, whereas a relative path is left untouched. Updated the test cases to support this if this is reimplemented.
2013-10-08Move in memory target into target module.Noah Campbell
2013-09-20Section is determined by the source, not the urlNoah Campbell
This change allows for top level html content to exists.
2013-09-18Fix parsing edge case of frontmatterNoah Campbell
When the frontmatter contains a - (or other delimiter) close to the closing frontmatter delimiter, frontmatter detection would fail.
2013-09-17Merge remote-tracking branch 'origin/parser' into mrg_praserNoah Campbell
Also brought in parse for github.com/noahcampbell/akebia Conflicts: hugolib/page.go hugolib/page_test.go
2013-09-17Move AbUrlify to post content transformationNoah Campbell
Currently the a@href and script@src elements will have BaseUrl applied to their elements prior to being written to disk.
2013-09-13Add /index.html to unadorned alias pathsNoah Campbell
Bring code to be better in line with documentation.
2013-09-12Move 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-12Move 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-04Introduce 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-03Expand the ShowPlan functionalityNoah Campbell
2013-08-30Externalize 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.