mirror of
https://github.com/trambarhq/relaks-wordpress-example.git
synced 2025-09-24 22:41:31 +02:00
Fixed image links (issue #31).
This commit is contained in:
@@ -147,7 +147,13 @@ class Route {
|
|||||||
|
|
||||||
transformNode = (node) => {
|
transformNode = (node) => {
|
||||||
if (node.type === 'tag') {
|
if (node.type === 'tag') {
|
||||||
|
let { siteURL } = this.params;
|
||||||
if (node.name === 'a') {
|
if (node.name === 'a') {
|
||||||
|
} else if (node.name === 'img') {
|
||||||
|
// prepend image URL with site URL
|
||||||
|
if (node.attribs.src && !_.startsWith(node.attribs.src, /https?:/)) {
|
||||||
|
node.attribs.src = siteURL + node.attribs.src;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (node.type === 'text') {
|
} else if (node.type === 'text') {
|
||||||
// trim off leading newline characters
|
// trim off leading newline characters
|
||||||
|
Reference in New Issue
Block a user