MishkaCmsCore.Runtime.Resources.Changes.PagePath (Mishka CMS Core v0.0.5-alpha.13)

Copy Markdown View Source

Writes a page's path the way the router serves it: without a trailing /. The router answers /about/ as /about, so a page stored at /about/ and one at /about were two rows for one address, and unique_path_per_site and Validations.PagePathUnique compare the stored string. / stays /, and the attribute's trim? constraint has already dropped the spaces around the path.

It is stored as MishkaCmsCore.Runtime.States.WebRunTimeMetaDataState.canonical_path/1 writes it, its %XX escapes decoded and in Unicode NFC, which is the form the resolver matches a request in: a page pasted as /fa/%D9%88... is stored, and served, as /fa/و....

Any other mistake in a path, no leading / or a ? or a # in it, is Validations.PathFormat's to refuse on the path field.

changes do
  change MishkaCmsCore.Runtime.Resources.Changes.PagePath, on: [:create, :update]
end