diff --git a/plugins/environment_variables.rb b/plugins/environment_variables.rb new file mode 100644 index 00000000000..7d9203f1643 --- /dev/null +++ b/plugins/environment_variables.rb @@ -0,0 +1,17 @@ +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 diff --git a/source/_includes/edit_github.html b/source/_includes/edit_github.html index f599869c811..b5fa2329b84 100644 --- a/source/_includes/edit_github.html +++ b/source/_includes/edit_github.html @@ -1,4 +1,4 @@ {% assign url_parts = page.url | split: '/' %} {% if page.hide_github_edit != true %} -
+ {% endif %}