Skip to content

iOvergaard/umbraco-servervariables

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Server Variables for Umbraco

Downloads NuGet GitHub license

Server variables exposed to the browser in Umbraco 15+ using the importmap.

What is it?

Server Variables was a thing up until Umbraco 13, where you could add variables to your site through the ServerVariablesParser.Parsing notification and access them in the Backoffice through Umbraco.Sys.ServerVariables. This was removed in Umbraco 14, but this package reintroduces the concept with a twist.

In short, this package gives you a simple way to expose server variables to your Umbraco Backoffice and/or Frontend. It allows you to add server variables to your site without having to write any or only a little code.

The variables are added either through appsettings.json or through the IServerVariablesService interface and are accessed through an importmap in the browser:

import vars from 'vars';

console.log(vars); // { apiUrl: 'https://api.example.com' }

Installation

Add the package to an existing Umbraco website (v15+) from nuget:

dotnet add package Umbraco.Community.ServerVariables

Usage

See the documentation for more information.

Contributing

Contributions to this package are most welcome! Please read the Contributing Guidelines.

About

Package for Umbraco CMS to easily expose static variables from the backend to the frontend

Topics

Resources

License

Contributing

Stars

Watchers

Forks