Add additional options for Location title generation #66
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR offers a few new ways to specify titles for HTML pages.
Discussion
Currently, there's a
titleSeparator
property in thehead
method exposed by Publish for use in the Plot DSL:The format of the title is fixed: you'll get
Location.title
andSite.name
separated by a separator (About Us | Website
).This PR changes the API of that
head
method to expose atitleStyle
property which takes an enum:The default remains the same—if you haven't specified
titleSeparator
in your head method, it will continue to outputLocation | Site
. However, with this PR you have some flexibility:locationTitle
will output just the Location's title:titleAndSiteName(separator: String)
is the existing default:fixed(string: String)
lets you override the title in the template:The updated API can be used as such:
Implications
Because this PR changes the API for the
head
method, it can/will break existing Publish projects. I think there's a way to supply the updated API to Xcode's "fixit" functionality, but I haven't had time to research that just yet.On the positive side, the enum makes it easy to add new title generation techniques in the future. There are some other ways of addressing the same underlying need, but this seems like a good compromise of simplicity vs expressivity.
Thanks for reading!