Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Static Site Generator support #844

Open
wants to merge 244 commits into
base: master
from

Conversation

@nvella
Copy link
Member

commented Aug 5, 2019

Hi all,

I've implemented basic support for external static site generators. There is still much work to be done, however what has been completed so far can be considered a minimum viable product, with extended support to be added as myself and/or others get around to it.

Aim

The aim of the support is to provide an experience to users publishing to static sites, just as if they were publishing to a hosted blog. All relevant metadata of the item from Open Live Writer shall be used to generate item front matter or determine other parameters. I'd like for the support to work with as many static site generators as possible, however I mainly developed against Jekyll due to it's support on GitHub Pages. Due to this, there may be some missing provisions for other generators, which I'll work through as they're brought to my attention.

What it does so far

  • Creation of item (post/page) HTML files in a user-definable posts/pages directory, with support for YAML front matter based upon post metadata provided by Open Live Writer.
    • Support for images via a user-definable images directory.
    • Support for hierarchical pages.
    • Support for tags. (presented to OLW as categories)
    • Support for remote drafts
  • Loading and deletion of posts created by the Static Site support.
  • Auto-detection of publishing template via publishing of temporary post.
  • Runs external publish and optional build commands for post publishing.
    • Presents error on non-zero exit-codes.
  • Supports configuration of many aspects of the support, including paths, commands, front matter keys, timeouts, and other behaviours.

What it doesn't do (yet)

  • The support currently does not output in Markdown; it is currently HTML-only. Strictly speaking, Markdown support is an entirely separate feature that will be implemented in the editor and supported on a case-by-case blog client basis, and requires deciding if OLW will support WYSIWIG on Markdown, amongst other questions.
  • The support currently does not load posts or pages that were not authored with Open Live Writer. This is due to the support expecting each item to have a unique id attribute in their front matters. Giving an id attribute to an existing HTML item should be enough to make Open Live Writer recognise it.
  • The support currently does not preserve or allow for arbitrary front matter keys.
  • The support currently does not allow for non-YAML front matter, eg. TOML.
  • The support currently does not allow for non-flat item folder structures in the project folder; i.e. it expects all items of a specific kind to be in the specified folder. This is usually the case for posts, but for pages it typically varies from generator-to-generator. Some generators, such as Jekyll, allow for the setting of a permalink attribue in front matter to determine the output folder structure. The support will currently automatically generate this parameter based on the page parent and it's hierarchy.

Other changes

  • This PR closes issues #548 and #31; Open Live Writer will now automatically navigate to posts on auto-detection if it detects the post title, but not the body.
  • Various methods were added to LayoutHelper to accommodate for various DPI scaling scenarios.
  • L10n
    • LocUtil was modified to allow regeneration of only Strings resources, and a script was added to the project root to allow for easy regeneration of these resources.
    • A small WinForms utility was added ("LocEdit") to allow for convenient editing of Strings.csv.
    • Strings.csv was updated to include the ad-hoc changes that have been made to the underlying compiled resources over the past few years.

Testing

An AppVeyor build can be found here. Please keep in mind that is this a PR CI build, it does not include Google Blogger authentication tokens. It will also be subject to issue #838; a workaround is described in that issue.

Thanks

I'd like to give my thanks to all that have given words of support on Twitter and elsewhere. It's been a long 40 days or so, but I hope this new feature spawns a new interest in the Open Live Writer project as a whole, and encourages others to dive into the code.

nvella added some commits Jun 30, 2019

ssg: WeblogConfigurationWizardController: set blog provider, client a…
…nd service type from constants, set HomepageUrl and Credentials from SSG wizard panel
ssg: WeblogConfigurationWizardPanelStaticSiteConfig: implement IAccou…
…ntBasicInfoProvider, return a Credentials with site configuration
ssg: IBlogClient, BlogClientBase, BlogSettingsDetector, ...: BlogClie…
…nt RemoteDetection Possible attribute, return true for all clients except StaticSiteClient
ssg: StaticSiteClient: set SupportsPages client option based on if we…
… were passed a pages path, set SupportsPostAsDraft to false
@nvella

This comment has been minimized.

Copy link
Owner Author

commented on 037d268 Aug 5, 2019

Apologies, was meaning OpenLiveWriter#377 in commit message not OpenLiveWriter#337.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant
You can’t perform that action at this time.