Access to serverOptions
in eleventy config
#3273
Labels
enhancement
needs-votes
A feature request on the backlog that needs upvotes or downvotes. Remove this label when resolved.
Is your feature request related to a problem? Please describe.
I created a
absoluteurl
filter that converts a relative URL or an absolute path to an absolute URL. I would like it to behave like Jekyll'sabsolute_url
filter. It prepends abaseurl
value to the input.The filter should do the following:
{{ "/about.html" | absoluteurl }}
would produce "https://localhost:8080/about.html" in dev. Whatever is the default of the local server.{{ "/about.html" | absoluteurl }}
would produce "https://www.roboleary.net/about.html" in production when I provide a value ofhttps://www.roboleary.net
tobaseurl
.Since I cannot obtain the server host name and port, I am unable to do this for dev mode. Instead I return the input
url
.Describe the solution you'd like
Access the
serverOptions
object with details about server.Describe alternatives you've considered
I tried to use
eleventyConfig.getMergingConfigObject().serverOptions
in the eleventy config file, however it is empty. I guess that this could be because the server is not initiated yet. Is this a timing issue?Additional context
This is the current implementation:
The text was updated successfully, but these errors were encountered: