All notable changes to
the dillonkearns/elm-pages
elm package
will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Updated version constraint so users now need to use "mdgriffith/elm-codegen": "5.0.0 <= v < 6.0.0" (be sure to update your
scripts/elm.json
as well!)
BackendTask.Stream
API for creating and running/reading a pipeline of streams through NodeJS's native Stream APIs, including executing shell commands.Pages.Script.command
andPages.Script.exec
functions for running shell commands (simpler verison of the command helpers inBackendTask.Stream
, which allow piping input to/from the commands, and piping multiple commands together).BackendTask.Glob.captureStats
for capturingFileStats
forGlob
matches. Can be used to capture file metadata including size, created time, last modified time, etc.BackendTask.Glob.fromString
andBackendTask.Glob.fromStringWithOptions
allow capturing matching file paths directly from a string pattern. Useful for use with executing shell commands since there is no glob expansion in the command API.Pages.Script.Spinner
module for executingBackendTask
s with loading spinners inelm-pages
scripts.BackendTask.Do
module with helpers for using continuation-style in scripts orBackendTask
definitions.BackendTask
now carries context that effects verbosity (quiet
), working directory (inDir
), and environment variables (withEnv
).- New functions in
BackendTask
module:do
,doEach
,failIf
,sequence
- New functions in
Pages.Script
module:doThen
,question
,sleep
,which
,expectWhich
.
- Redirecting to an external URL from an
action
now redirects correctly. - Fixed error when Glob pattern had leading
./
(see #469) - Fixed
FilesAndFolders
option inGlob
module, (see #461)
- Update elm-review version for an internally used rule to the latest Elm package to support newer elm-review NPM executable (fixes #364).
- Allow reading files with absolute paths (still reads relative path by default), see #390.
- Fix
Scaffold.Route.preRender
- added an incorrect parameter that resulted in a compilation error in generated boilerplate.
- Change
Scaffold.Route.preRender
to intelligently useRouteBuilder.single
orRouteBuilder.preRender
as appropriate based on whether themoduleName
to generate has any dynamic route segments in it.Scaffold.Route.single
is therefore deprecated as obsolete and will be removed in a future release. - Updated version constraint so users now need to use "mdgriffith/elm-codegen": "4.0.0 <= v < 5.0.0" (be sure to update your
scripts/elm.json
as well!) - Updated version constraint so users now need to use "dillonkearns/elm-bcp47-language-tag": "2.0.0 <= v < 3.0.0"
- Cleaned up handling of navigating to new pages with query parameters, and navigating to links with
#
's (named anchors). See #389. Thank you to@kyasu1
for the issue report and suggested fixes!
- Change htmlFor HTML property to for HTML attribute in rendered HTML.
<style>
tags were escaping>
characters when they should be preserved in that context. Fixed the pre-rendered HTML escaping to not escape for style tags.
- Removed an argument from Site.config.
- You can now set the language of the root document with
Head.rootLanguage
.
- Replaced
Pages.PagePath.PagePath pathKey
type withPath
. The latestelm-pages
generates aRoute
type for you, so you get some type-safety from that already. In a future release, there will likely be a tool to help integrate DataSource values withelm-review
so you can check that programatically referenced pages exist (not just the route but the specific page). Pages.Platform.init
is no longer used to create the main entrypoint. Instead,elm-pages
wires that up under the hood from the main files you write.StaticHttp
has been renamed toDataSource.Http
. The coreDataSource
module has theDataSource
type and the functionsmap
,andThen
,and other functions that aren't HTTP specific. There are additional modules nowDataSource.Glob
,DataSource.Port
, andDataSource.File
.
Pages.ImagePath.ImagePath pathKey
has been removed - anelm-review
integration could help users build checks for referencing valid files in the future, but in a way that doesn't increase the bundle size (generating a record with entries for every page and every image file increases the Elm bundle size as the number of pages/files grows, whereas usingelm-review
doesn't incur a runtime cost at all).
See the upgrade guide for some information for getting to the latest version, and how to try out the 2 new opt-in beta features: https://github.com/dillonkearns/elm-pages/blob/master/docs/7.0.0-elm-package-upgrade-guide.md.
- Fixed a bug where using
ImagePath.external
in anyHead
tags would prepend the canonical site URL to the external URL, creating an invalid URL. Now it will only prepend the canonical site URL for local images, and it will use external image URLs directly with no modifications. - StaticHttp performance improvements - whether you use the new beta build or the existing
elm-pages build
orelm-pages develop
commands, you should see significantly faster StaticHttp any place you combined multiple StaticHttp results together. I would welcome getting any before/after performance numbers!
- There is now an
icons
field in theManifest.Config
type. You can use an empty List if you are not using the beta no-webpack build (it will be ignored if you useelm-pages build
, but will be used going forward with the beta which will eventually replaceelm-pages build
).
- There are 2 new beta features, a new beta no-webpack build and a beta Template Modules feature (see https://github.com/dillonkearns/elm-pages/blob/master/docs/7.0.0-elm-package-upgrade-guide.md for detailed info and instructions).
- Fixed missing content message flash for pages that are hosted on a sub path: #106.
- Fixed issue where CLI would hang when fetching StaticHttp data for
generateFiles
functions. The problem was a looping condition for completing the CLI process to fetch StaticHttp data. See #120.
- Make sure the build fails when there are
Err
results in any markdown content. Fixes #102. This fix also means that any markdown errors will cause the error overlay in the dev server to show.
- Use builder pattern to build application. In place of the old
Pages.Platform.application
, you now start building an application config withPages.Platform.init
, and complete it withPages.Platform.toProgram
. You can chain on some calls to your application builder. This is handy for creating plugins that generate some files and add some head tags usingwithGlobalHeadTags
. - The
documents
key is now a List of records. ThePages.Document
module has been removed entirely in place of a simplified API.elm-markup
files no longer have any special handling and the direct dependency was removed fromelm-pages
. Instead, to useelm-markup
withelm-pages
, you now wire it in as you would with a markdown parser or any other document handler. - Replaced
generateFiles
field inPages.Platform.application
with thePages.Platform.withFileGenerator
function. - Instead of using the
zwilias/json-decode-exploration
package directly to build up optimizable decoders, you now use theOptimizedDecoder
API. It provides the same drop-in replacement, with the same underlying package. But it now uses a major optimization where in your production build, it will run a plainelm/json
decoder (on the optimized JSON asset that was produced in the build step) to improve performance.
- Added
Head.Seo.structuredData
. Check out Google's structured data gallery to see some examples of what structured data looks like in rich search results that it provides. Right now, the API takes a simpleJson.Encode.Value
. In theelm-pages
repo, I have an example API that I use, but it's not public yet because I want to refine the API before releasing it (and it's a large undertaking!). But for now, you can add whatever structured data you need, you'll just have to be careful to build up a valid format according to schema.org. Pages.Directory.basePath
andPages.Directory.basePathToString
helpers.- You can now use
StaticHttp
for your generated files! The HTTP data won't show up in your production bundle, it will only be used to produce the files for your production build. - Added
Pages.PagePath.toPath
, a small helper to give you the path as aList String
.
- You can now host your
elm-pages
site in a sub-directory. For example, you could host it at mysite.com/blog, where the top-level mysite.com/ is hosting a different app. This works using HTML<base>
tags. The paths you get fromPagePath.toString
andImagePath.toString
will use relative paths (e.g.blog/my-article
) instead of absolute URLs (e.g./blog/my-article
), so you can take advantage of this functionality by just making sure you use the path helpers and don't hardcode any absolute URL strings. See #73.
StaticHttp.stringBody
now takes an argument for the MIME type.
StaticHttp.unoptimizedRequest
allows you to decode responses of any type by passing in aStaticHttp.Expect
.StaticHttp.expectString
can be used to parse any values, like XML or plaintext. Note that the payload won't be stripped down so be sure to check the asset sizes that you're fetching carefully.
- Fixed an issue where "Missing content" message flashed for the root page.
- Scroll up to the top of the page on page navigations (Elm's core Browser.application doesn't do this automatically). This change preserves the behavior for navigating to anchor links, so you can still go to a fragment and it will take you to the appropriate part of the page without scrolling to the top in those cases.
- Pass allRoutes into pre-rendering for #60.
- Added URL query and fragment in addition to the PagePath provided by
init
andonPageChange
. See #39. The new data structure used looks like this:
{ path : PagePath Pages.PathKey
, query : Maybe String
, fragment : Maybe String
}
- There's a new
generateFiles
endpoint. You pass in a function that takes a page's path, page metadata, and page body, and that returns a list representing the files to generate. You can see a working example for elm-pages.com, here's the entry point, and here's where it generates the RSS feed. You can pass in a no-op function like\pages -> []
to not generate any files.
- Fix missing content flash (that was partially fixed with #48) for some cases where paths weren't normalized correctly.
- "Missing content" message no longer flashes between pre-rendered HTML and the Elm app hydrating and taking over the page. See #48.
- Don't reload pages when clicking a link to the exact same URL as current URL. Fixes #29.
Check out this upgrade checklist for more details and steps for upgrading your project.
- There's a new StaticHttp API. Read more about it in this
StaticHttp
announcement blog post! - The generated
Pages.elm
module now includesbuiltAt : Time.Posix
. Make sure you haveelm/time
as a dependency in your project! You can use this when you make API requests to filter based on a date range starting with the current date. If you want a random seed that changes on each build (or every week, or every month, etc.), then you can use this time stamp (and perform modulo arithemtic based on the date for each week, month, etc.) and use that number as a random seed.
- Instead of initializing an application using
Pages.application
from the generatedPages
module, you now initialize the app usingPages.Platform.application
which is part of the published Elm package. So now it's easier to browse the docs. You pass in some internal data from the generatedPages.elm
module now by including this in the application config record:Pages.Platform.application { internals = Pages.internals, ... <other fields> }
. - Add init argument and user Msg for initial PagePath and page changes (see #4).
- Generate files for extensions other than
.md
and.emu
(fixes #16). As always, be sure to also use the latest NPM package.