我有一个不到10页的小型网站。
title标签包含站点名称,如下所示:
2018-09-02 16:11:24+0800 [BaseRedisProtocol,client] <twisted.internet.tcp.Connector instance at 0x9951e2c> will retry in 2 seconds
2018-09-02 16:11:24+0800 [BaseRedisProtocol,client] Stopping factory <txredisapi.RedisFactory instance at 0x9951dac>
2018-09-02 16:11:24+0800 [__main__.PlainTCPFactory] (TCP Port 6000 Closed)
2018-09-02 16:11:24+0800 [__main__.PlainTCPFactory] Stopping factory <__main__.PlainTCPFactory instance at 0x9962aac>
2018-09-02 16:11:24+0800 [__main__.PlainTCPFactory] afterRunning(): load from redis for logging
2018-09-02 16:11:24+0800 [__main__.PlainTCPFactory] Unhandled error in Deferred:
2018-09-02 16:11:24+0800 [__main__.PlainTCPFactory] Unhandled Error
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-i686.egg/twisted/internet/defer.py", line 1107, in _inlineCallbacks
result = g.send(result)
File "EpicGlinkTcpServer.py", line 893, in stopFactory
yield rcs.delete(self.onlineDevices)
File "/usr/local/lib/python2.7/dist-packages/txredisapi-1.2-py2.7.egg/txredisapi.py", line 1698, in wrapper
d = self._factory.getConnection()
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-i686.egg/twisted/internet/defer.py", line 1253, in unwindGenerator
return _inlineCallbacks(None, gen, Deferred())
--- <exception caught here> ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-15.0.0-py2.7-linux-i686.egg/twisted/internet/defer.py", line 1107, in _inlineCallbacks
result = g.send(result)
File "/usr/local/lib/python2.7/dist-packages/txredisapi-1.2-py2.7.egg/txredisapi.py", line 2037, in getConnection
raise ConnectionError("Not connected")
txredisapi.ConnectionError: Not connected
我正在使用以下代码将页面标题动态地附加到标题标签:
<title><?php echo SITE_NAME; ?></title>
此动态生成的页面标题是否对搜索引擎可见? 标题和站点名称一起显示在SERPS中吗?
答案 0 :(得分:1)
尽管大型企业SE可以并且经常提供JS渲染,但是它们不能渲染所有内容,也不会触发任何用户操作。因此,这在很大程度上取决于如何以及何时调用此代码段。另外,至少Google并不总是将源中的标题用作搜索结果中的图块。 但是,强烈建议您不要这样做。恕我直言,这种方法效率极低且无法扩展。另外,大多数爬虫会以这种方式错过您的标题。