diff --git a/bridgetown.config.yml b/bridgetown.config.yml index a7d314f..ec923fb 100644 --- a/bridgetown.config.yml +++ b/bridgetown.config.yml @@ -14,14 +14,14 @@ # https://learnxinyminutes.com/docs/yaml/ # -url: "" # the base hostname & protocol for your site, e.g. https://example.com +url: "https://test.com" # the base hostname & protocol for your site, e.g. https://example.com permalink: pretty template_engine: erb # Other options you might want to investigate: -# +# # base_path: "/" # the subpath of your site, e.g. /blog # timezone: America/Los_Angeles # pagination: -# enabled: true \ No newline at end of file +# enabled: true diff --git a/plugins/builders/vercel_url.rb b/plugins/builders/vercel_url.rb new file mode 100644 index 0000000..3e6f5bd --- /dev/null +++ b/plugins/builders/vercel_url.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class Builders::VercelUrl < SiteBuilder + def build + hook :site, :pre_render do |site| + next unless ENV["VERCEL_URL"] && ENV["VERCEL_ENV"] != "production" + + Bridgetown.logger.info("Subbing Vercel URL") + site.config.update(url: "https://#{ENV["VERCEL_URL"]}") + end + end +end diff --git a/src/_layouts/default.erb b/src/_layouts/default.erb index f0a8692..53596d5 100644 --- a/src/_layouts/default.erb +++ b/src/_layouts/default.erb @@ -7,6 +7,7 @@ <%= render Shared::Navbar.new(metadata: site.metadata, resource: resource) %>
+ Absolute URL: <%= resource.absolute_url %> <%= yield %>