lcotte
August 17, 2022, 8:39pm
1
Hello Sebastian,
Now that we can have assets inside a folder,I’m wondering if you’re planning add the ability to add the folder name with the slug when accessing an asset.
So instead of have this
img src=“https://website/api/assets/app/picture.jpg ”
I would have
img src=“https://website/api/assets/app/ folder /picture.jpg”
Wondering if this is something your planning to add?
Thank you.
No plans for that. The slugs are unique within the api, not within a folder and I have a no plans to change that.
If the reason is SEO, you can add a additional values after the slug:
/// </summary>
/// <param name="app">The name of the app.</param>
/// <param name="idOrSlug">The id or slug of the asset.</param>
/// <param name="request">The request parameters.</param>
/// <param name="more">Optional suffix that can be used to seo-optimize the link to the image Has not effect.</param>
/// <returns>
/// 200 => Asset found and content or (resized) image returned.
/// 404 => Asset or app not found.
/// </returns>
[HttpGet]
[Route("assets/{app}/{idOrSlug}/{*more}")]
[ProducesResponseType(typeof(FileResult), StatusCodes.Status200OK)]
[ApiPermission]
[ApiCosts(0.5)]
[AllowAnonymous]
public async Task<IActionResult> GetAssetContentBySlug(string app, string idOrSlug, AssetContentQueryDto request, string? more = null)
{
var requestContext = Context.Clone(b => b.WithoutAssetEnrichment());
var asset = await assetQuery.FindAsync(requestContext, DomainId.Create(idOrSlug), ct: HttpContext.RequestAborted);
e.g.
img src=“https://website/api/assets/app/my-slug/image-description-just-for-seo
system
Closed
August 21, 2022, 9:06am
3
This topic was automatically closed after 2 days. New replies are no longer allowed.