mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-05-03 01:28:58 +00:00

* Make edit links GitHub aware * Fix repo url * don't mutate existing string * Move comment * Fix url
18 lines
661 B
Ruby
18 lines
661 B
Ruby
module Jekyll
|
|
class EnvironmentVariablesGenerator < Generator
|
|
def generate(site)
|
|
# https://www.netlify.com/docs/continuous-deployment/#build-environment-variables
|
|
repo_url = ENV['REPOSITORY_URL'] || 'https://github.com/home-assistant/home-assistant.github.io'
|
|
|
|
# Rewrite urls if repo url is the ssh format.
|
|
if repo_url.start_with? 'git@github.com:'
|
|
repo_url = repo_url.sub 'git@github.com:', 'https://github.com/'
|
|
end
|
|
|
|
# These values will be available as {{ site.NLY_REPOSITORY_URL }}
|
|
site.config['NLY_REPOSITORY_URL'] = repo_url
|
|
site.config['NLY_HEAD'] = ENV['HEAD'] || 'current'
|
|
end
|
|
end
|
|
end
|