Skip to content

Is it possible to have a dynamic url prefix? #335

Answered by jameslittle230
jkrumbiegel asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @jkrumbiegel! Thanks for writing in.

I think you have two options. You could either change your url_prefix so that it references the /stable/ urls, or you can use the transformResultUrl JS API to rewrite the URLs from some template string to your version string.

If you were to go that second route, it might look something like setting your config's URL prefix to something like:

[input]
url_prefix = "https://my-cool-docs-site.net/{VERSION}/"

and then, when you register Stork on the page:

const currentVersion = "v2.5.1"; // exported from build system
stork.register("search-index", "https://https://my-cool-docs-site.net/index.st", {
   transformResultUrl: (url) => url.replaceAll("{VERSION}",

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jkrumbiegel
Comment options

Answer selected by jameslittle230
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants