Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Html.RenderUmbracoFormDependencies() should use asp-append-version #773

Closed
skttl opened this issue May 16, 2022 · 8 comments
Closed

Html.RenderUmbracoFormDependencies() should use asp-append-version #773

skttl opened this issue May 16, 2022 · 8 comments
Labels
release/13.1.0 state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/feature

Comments

@skttl
Copy link

skttl commented May 16, 2022

To make form dependencies cacheable to the maximum, we need to version their urls. Can we have the outputted script tag include asp-append-version="true" to make .net append a version querystring?


This item has been added to our backlog AB#38203

@AndyButland
Copy link

Unfortunately this doesn't look to be straightforward to do. Simply applying the attribute doesn't seem to do anything.

From what I read this is only intended to work for files served from wwwroot, but these are coming from the App_Plugins folder, so I think that's why.

@ronaldbarendse
Copy link

@AndyButland The asp-append-version uses the WebRootFileProvider to get access to the file contents, so it will only work in 9.3+ (see PR umbraco/Umbraco-CMS#11783). Prior to this, the App_Plugins files were served by a separate UseStaticFiles(), thus not exposing the files via the IFileProvider abstraction... I should be safe to include this though, as it will be ignored if it can't find the file.

@AndyButland
Copy link

I was testing with 9.4.1 though... it didn't seem to do anything when I added the attribute (just came through into the browser as is, and without adding a querystring).

@bjarnef
Copy link

bjarnef commented Dec 14, 2023

@AndyButland does the Html.RenderUmbracoFormDependencies() has any overloads?
The docs mention it here https://docs.umbraco.com/umbraco-forms/v/12.forms.latest/developer/prepping-frontend but with Forms v12.1.2 I only have this:

image

@AndyButland
Copy link

From 12.2 you should find the following available:

IHtmlContent RenderUmbracoFormDependencies(this IHtmlHelper htmlHelper, IUrlHelper urlHelper, object? htmlAttributes = null)

@bjarnef
Copy link

bjarnef commented Dec 14, 2023

Yes, I just noticed that.
Maybe v12 docs should mention that since it wasn't available in v12.1.2, but in v12.2.0 it is :)
https://docs.umbraco.com/umbraco-forms/v/12.forms.latest/developer/prepping-frontend

@skttl
Copy link
Author

skttl commented Feb 12, 2024

asp-append-version is using IFileVersionProvider to add the file version to the url - maybe you can copy that logic into the Html.RenderFormsScripts helper. That would help me a lot :)

Or the simpler version, just add v=current_umbraco_forms_version

@AndyButland AndyButland added state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks release/13.1.0 labels Feb 23, 2024
@AndyButland
Copy link

We've gone with your "simpler" version @skttl - so from 13.1 you should find these versioned URLs being output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release/13.1.0 state/sprint-candidate We're trying to get this in a sprint at HQ in the next few weeks type/feature
Projects
None yet
Development

No branches or pull requests

5 participants