theme-next / hexo-theme-next

Elegant and powerful theme for Hexo.
https://theme-next.org
Other
8.17k stars 2.05k forks source link

开启exturl后,搜索引擎无法检测到友链。With exturl enabled, search engines cannot detect friend links in sidebar blogrolls. #589

Open ZvonimirSun opened 5 years ago

ZvonimirSun commented 5 years ago

Issue Checklist

I agree and want to create new issue


Expected behavior

侧边栏友情链接部分的外链不加密。

Don't add external URL with BASE64 encrypt & decrypt on friend links in sidebar blogrolls.

Actual behavior

在v6.7.0中,侧边栏友情链接部分的外链是通过异步加载方式加载出来的。虽然这里的链接没有被替换成加密链接,但是由于是异步加载出的链接,搜索引擎无法检测到页面上存在外链,达不到友情链接的应有效果。

In v6.7.0, friend links in sidebar blogrolls is loaded by asynchronous loading, and the search engine cannot detect that there is an exturnal link on the page, and the effect of friend links is not achieved.

在最新master中的版本,侧边栏友情链接部分的外链也被自动加密。

And in the master version, the friend links in sidebar blogrolls are also encrypted automatically.

Steps to reproduce the behavior

  1. 主题配置文件中设置以下内容。
# Automatically add external URL with BASE64 encrypt & decrypt.
exturl: true

Node.js and NPM Information

v8.15.0
6.4.1

Package dependencies Information

{
  "name": "iszy-blog",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "g": "hexo g --config source/_data/next.yml",
    "w": "hexo g -w --config source/_data/next.yml",
    "d": "hexo d --config source/_data/next.yml",
    "gd": "hexo g -d --config source/_data/next.yml"
  },
  "hexo": {
    "version": "3.8.0"
  },
  "dependencies": {
    "acorn": "^6.0.5",
    "ajv": "^6.5.4",
    "eslint": "^5.12.0",
    "hexo": "^3.7.1",
    "hexo-deployer-ftpsync": "^0.1.1",
    "hexo-deployer-git": "^1.0.0",
    "hexo-generator-archive": "^0.1.4",
    "hexo-generator-category": "^0.1.3",
    "hexo-generator-feed": "^1.2.2",
    "hexo-generator-index": "^0.2.0",
    "hexo-generator-searchdb": "^1.0.8",
    "hexo-generator-sitemap": "^1.2.0",
    "hexo-generator-tag": "^0.2.0",
    "hexo-related-popular-posts": "^3.0.3",
    "hexo-renderer-ejs": "^0.3.0",
    "hexo-renderer-marked": "^0.3.0",
    "hexo-renderer-stylus": "^0.3.1",
    "hexo-server": "^0.3.3",
    "hexo-symbols-count-time": "^0.4.4",
    "hexo-tag-dplayer": "^0.3.3",
    "hexo-wordcount": "^3.0.2",
    "uglify-js": "^3.4.9",
    "webpack": "^4.20.2"
  }
}# 

Hexo Information

Hexo version

hexo: 3.8.0
hexo-cli: 1.1.0
os: Linux 4.9.142-0409142-generic linux x64
http_parser: 2.8.0
node: 8.15.0
v8: 6.2.414.75
uv: 1.23.2
zlib: 1.2.11
ares: 1.10.1-DEV
modules: 57
nghttp2: 1.33.0
napi: 3
openssl: 1.0.2q
icu: 60.1
unicode: 10.0
cldr: 32.0
tz: 2017c

Hexo Configuration

# Hexo Configuration
## Docs: https://hexo.io/docs/configuration.html
## Source: https://github.com/hexojs/hexo/

# Site
title: 随遇而安
subtitle: 在自由的空气中漂浮
description: 生活吐槽 & 学习记录
keywords: 随遇而安, iszy
author: Sun Ziyang
language: zh-CN
timezone: Asia/Shanghai

# URL
## If your site is put in a subdirectory, set url as 'http://yoursite.com/child' and root as '/child/'
url: https://www.iszy.cc
root: /
permalink: :year/:month/:day/:title/
permalink_defaults:

# Directory
source_dir: source
public_dir: public
tag_dir: tags
archive_dir: archives
category_dir: categories
code_dir: downloads/code
i18n_dir: :lang
skip_render:

# Writing
new_post_name: :title.md # File name of new posts
default_layout: post
titlecase: false # Transform title into titlecase
external_link: true # Open external links in new tab
filename_case: 0
render_drafts: false
post_asset_folder: false
relative_link: false
future: true
highlight:
  enable: true
  line_number: true
  auto_detect: false
  tab_replace:

# Home page setting
# path: Root path for your blogs index page. (default = '')
# per_page: Posts displayed per page. (0 = disable pagination)
# order_by: Posts order. (Order by date descending by default)
index_generator:
  path: ''
  per_page: 10
  order_by: -date

# Category & Tag
default_category: uncategorized
category_map:
tag_map:

# Date / Time format
## Hexo uses Moment.js to parse and display date
## You can customize the date format as defined in
## http://momentjs.com/docs/#/displaying/format/
date_format: YYYY-MM-DD
time_format: HH:mm:ss

# Pagination
## Set per_page to 0 to disable pagination
per_page: 10
pagination_dir: page

# Extensions
## Plugins: https://hexo.io/plugins/
## Themes: https://hexo.io/themes/
theme: next

NexT Information

NexT Version:

NexT Scheme:

NexT Configuration:

exturl: true

# Blog rolls
links_icon: link
links_title: 友情链接
#links_layout: block
links_layout: inline
links:
  随遇而安: https://www.iszy.cc/links/
  3NICE: https://3nice.cc/

Other Information

ivan-nginx commented 5 years ago

This tag need to remove, actually, he not need anymore. Because exturl.js tag was replaced by exturl.js filter. Filter just make autoreplace all links by extlinks in post.

With tag we need to write: {% exturl link path %} With filter we just write simple link: [link](path)

next-url.js helper used only on templates (swig files). So, if we want to remove sidebar blogrolls, we can modify this line:

https://github.com/theme-next/hexo-theme-next/blob/716f593727981ca7a14869f4c89c293674caa84f/layout/_macro/sidebar.swig#L139


But i dont understand why it needed? Not to encrypt blogroll links. Can u explain this? And we can also just add option on this links.

ZvonimirSun commented 5 years ago

@ivan-nginx emmm, I think that blogroll links are used to increase backlinks, increase the weight of the website, such as Google PR value, and to attract search engine spiders to crawl links. When they are encrypted, the search engines can't find those links.

ivan-nginx commented 5 years ago

I think that blogroll links are used to increase backlinks, increase the weight of the website

U think or u know? Maybe vise versa? Decrease weight of website? Because:

  1. This all are external links. Links to another domain, not to your domain. And if u will not have this links on your domain, but 10 external domains will linked to your domain – this will increase, yes. But what's the difference if on your site will 1 link to your friend's site and vise versa? 1 link from, 1 link 2 = 0 weight.
  2. This links also show on every page of your site, in sidebar – repeated links. And this is very bad for SEO.

Maybe we can read somewhere about SEO in similarities? Maybe i also can be wrong.

ZvonimirSun commented 5 years ago

@ivan-nginx I mean I exchange links with other people, they add my links and I shouldn't encrypt their links. The search engine really can't detect the encrypted links. By the way, if i reprint an article, I shouldn't encrypt the riginal link. Maybe it's necessary to keep some links unencrypted.

Maybe I should add an extra page to do this instead of putting them in the sidebar. Will there be a per_page switch for the exturl? That maybe a better way to solve my problem.

ivan-nginx commented 5 years ago

Ok, i'll add extra option on this links. Wait for feature.

ZvonimirSun commented 5 years ago

@ivan-nginx Thanks.

stevenjoezhang commented 5 years ago

@ZvonimirSun Replace this line https://github.com/theme-next/hexo-theme-next/blob/9f2d56af713bf873d59f11d525b1f5676c502a60/scripts/filters/exturl.js#L20

with

  $('a').not('.links-of-blogroll-item a').each(function() {