Is there a way to get the request URL “as it is” such that if the requested URL has a file with extension at the end, it will appear in some kind of page variable?
No additional permalink configurations is done. The page is generated using multiple format feature, which is why index.amp.html is very important for parsing.
EDIT:
The investigation above was done inside a short-code.
I’m not trying to build URL link. The goal is to extract the request URL and perform some analysis functions on it (e.g. slice it up, parse, analyze for decision making).
I meant by internal functions (for building the public/ artifact), not the front-end construction segment. I tested various ways to workaround the multiple outputs identification for shortcode. Seems like there is no way to work around it.
Acutally you can identify easily using the OutputFormats - AlternativeOutputFormats math. I built a partial shortcode for it (checking against my data set for consistency):
{{- /* . = Page data for processing */ -}}
{{- /* build dictionary checklist for checking all alternative formats */ -}}
{{- $list := dict -}}
{{- range $format := .Page.AlternativeOutputFormats -}}
{{- $list = merge $list (dict $format.Name $format) -}}
{{- end -}}
{{- /* scan for current output format from the list of all formats */ -}}
{{- $target := false -}}
{{- range $format := .Page.OutputFormats -}}
{{- if not (index $list $format.Name) -}}
{{- $target = $format -}}
{{- end -}}
{{- end -}}
{{- /* process output */ -}}
{{- $ret := .Site.Data.bissetii.mediaTypes.HTML -}}
{{- if $target -}}
{{- $ret = index .Site.Data.bissetii.mediaTypes $target.Name -}}
{{- end -}}
{{- $ret.Name -}}
The funny thing is when I inject this partial into both shortcode and the page itself, they both yield different results: