Skip to content
Snippets Groups Projects
Commit 37989bfa authored by Hugo SUBTIL's avatar Hugo SUBTIL
Browse files

fix(post): refacto of image url replace

parent 697aee31
No related branches found
No related tags found
1 merge request!115feat(structure): change addresse api in order to cover the all department....
......@@ -72,12 +72,15 @@ export class PostsService {
if (!postData.custom_excerpt) {
postData.excerpt = 'Inconnu';
}
const test = `<p>Test qui va bien Test qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bienTest qui va bien.</p><figure class=\"kg-card kg-image-card\"><img src=\"https://resin-dev.grandlyon.com/content/images/2022/01/resin-logo-1200x630.png\" class=\"kg-image\" alt loading=\"lazy\" width=\"1200\" height=\"630\" srcset=\"https://resin-dev.grandlyon.com/content/images/size/w600/2022/01/resin-logo-1200x630.png 600w, https://resin-dev.grandlyon.com/content/images/size/w1000/2022/01/resin-logo-1200x630.png 1000w, https://resin-dev.grandlyon.com/content/images/2022/01/resin-logo-1200x630.png 1200w\" sizes=\"(min-width: 720px) 720px\"></figure>`;
// Handle image display. Rewrite image URL to fit ghost infra issue.
if (postData.feature_image && !this.configService.isLocalConf()) {
postData.feature_image = `https://${this.configService.config.host}/blog/content${
postData.feature_image.split('/content')[1]
}`;
if (!this.configService.isLocalConf()) {
if (postData.feature_image) {
console.log('NOT LOCAL');
postData.feature_image = `https://${this.configService.config.host}/blog/content${
postData.feature_image.split('/content')[1]
}`;
}
const regex = /(https?:\/\/ghost):(\d*)?/g;
postData.html = postData.html.replace(regex, `https://${this.configService.config.host}/blog`);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment