无限星辰工作室-客户无限互联网动力之源
标题:
Discuz!x3.2门户文章图片Alt 问题SEO解决方案之一
[打印本页]
作者:
crx349
时间:
2014-12-1 23:19
标题:
Discuz!x3.2门户文章图片Alt 问题SEO解决方案之一
文件:
static/image/editor/editor_function.js
template/default/home/spacecp_blog.htm
另存:editor_function.js为bgeditor_function.js
编辑:
editor_function.js
查找:
function insertImage(image, url, width, height) {
url = typeof url == 'undefined' || url === null ? image : url;
width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
var html = '<p><a href="' + url + '" target="_blank"><img src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
edit_insert(html);
}
复制代码
修改为:
function insertImage(image, url, width, height,subject) {
url = typeof url == 'undefined' || url === null ? image : url;
width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
subject = $('title').value;
var html = '<p><a href="' + url + '" target="_blank"><img alt="'+subject+'" src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
edit_insert(html);
}
复制代码
再编辑:bgeditor_function.js
查找:
function insertImage(image, url, width, height) {
url = typeof url == 'undefined' || url === null ? image : url;
width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
var html = '<p><a href="' + url + '" target="_blank"><img src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
edit_insert(html);
}
复制代码
修改为
function insertImage(image, url, width, height,subject) {
url = typeof url == 'undefined' || url === null ? image : url;
width = typeof width == 'undefined' || width === null ? 0 : parseInt(width);
height = typeof height == 'undefined' || height === null ? 0 : parseInt(height);
subject = $('title').value;
var html = '<p><a href="' + url + '" target="_blank"><img alt="'+subject+'" src="'+image+'"'+(width?' width="'+width+'"':'')+(height?' height="'+height+'"':'')+'></a></p>';
edit_insert(html);
} {
复制代码
再编辑:template/default/home/spacecp_blog.htm
查找:
editor_function.js
复制代码
替换为
bgeditor_function.js
复制代码
覆盖同名文件,更新缓存,发布文章测试看看
欢迎光临 无限星辰工作室-客户无限互联网动力之源 (https://xmspace.net/)
Powered by Discuz! X3.4