decaporg / decap-cms

A Git-based CMS for Static Site Generators
https://decapcms.org
MIT License
17.84k stars 3.04k forks source link

Allow formatting the entire preview url and not just the path #3964

Open maxerbox opened 4 years ago

maxerbox commented 4 years ago

Is your feature request related to a problem? Please describe. I need to format the preview link given from the target_url statuse api. Indeed, my deploy provider is giving it in the wrong format.

Describe the solution you'd like A simple hook that would allow me to edit the deploy preview url

Describe alternatives you've considered

Additional context Could be done like https://github.com/netlify/netlify-cms/pull/3812

erezrokah commented 4 years ago

Hi @maxerbox what is the format of the target_url? Have you tried https://www.netlifycms.org/docs/deploy-preview-links/#configuring-preview-paths?

maxerbox commented 4 years ago

Hi @maxerbox what is the format of the target_url? Have you tried https://www.netlifycms.org/docs/deploy-preview-links/#configuring-preview-paths?

My target_url is not pointing on a preview version of the website, but on the building page of my deployment provider. It has this format: https://xxxx.com/maxerbox/sandrine-neau-website/gxb6qir7j the last part is an extract of the commit. I need to transform it to this format : https://sandrine-neau-website-gxb6qir7j.xxxx.app I think a hook is perfect for this case

erezrokah commented 4 years ago

Updated the title based on the suggestion from https://github.com/netlify/netlify-cms/pull/3966#issuecomment-652856738

typeofweb commented 3 years ago

The alternative implemented in #3966 would be more extensible. For example, I need to fetch preview URLs from an API based on the GitHub deployment data – that's no possible with the preview_url_formatter: ['regex', 'replacer'] approach.