Inject URL paramaters: turn a metapage into a configureable view
This is for advanced users or teams
Overview
URL parameters allow you to customize metapages by passing configuration values through the URL. This transforms static metapages into dynamically configurable views without modifying the underlying metapage.
You can add URL search and hash parameters to the metapage url, and those parameters will be passed down to the metaframes. e.g.
https://metapage.io/dion/40e42e0e53224cf99c0d20fa1323c043?tag=abc
This passes tag=abc
to the container metaframes. One of those builds a docker image from a git repository from a git tag: abc
:
https://github.com/metapages/test-github-refs/tree/${tag}
Now the entire metapage is configured to point to a specific tag.
How to Use URL Parameters in Different Metaframes
Javascript
import { getHashParamFromWindow } from 'https://cdn.jsdelivr.net/npm/@metapages/hash-query@0.8.4/+esm'
const tag = getHashParamFromWindow("tag")
log(`tag=${tag}`)
The above code block shows how to access URL hash parameters that are injected from the main webpage.
Containers
You can use this mechanism to define the exact git repo the docker image is built from.
Any $foo=bar
URL parameter is accessible by:
The git URL
The docker command
The container env vars
All browser URL parameters are available to the container environment as environment variables, except the following, which are used internally by the container metaframe, and thus cannot be overridden: [ autostart
, control
, config
, debug
, definition
, inputs
, queueOverride
, ignoreQueueOverride
, job
, queue
]
User defined env vars is on the roadmap