wordpress谷歌字体
Recently, one of our readers asked if it was possible to hide a WordPress page from Google? Sometimes you may need to hide a page from Google to protect your privacy or to keep away unwanted users. In this article, we will show you how to hide a WordPress page from Google without affecting your site’s overall SEO.
最近,我们的一位读者问是否可以从Google隐藏WordPress页面? 有时,您可能需要从Google隐藏页面以保护您的隐私或避免不必要的用户进入。 在本文中,我们将向您展示如何在不影响网站整体SEO的情况下从Google隐藏WordPress页面。
从Google隐藏WordPress帖子或页面 (Hiding a WordPress Post or Page From Google)
Search engines like Google allow website owners to exclude content from search results. You can do this by using your site’s robots.txt file or using HTML meta tags.
Google等搜索引擎允许网站所有者从搜索结果中排除内容。 您可以通过使用网站的robots.txt文件或HTML元标记来做到这一点。
We will show you how to do this in WordPress using two methods. You can choose the one that works best for you.
我们将向您展示如何使用两种方法在WordPress中执行此操作。 您可以选择最适合自己的一种。
We will also show you how to password protect posts and pages in WordPress. If you don’t want to use the first two methods, then this approach will allow you to control the visibility of your posts and pages for all users.
我们还将向您展示如何用密码保护WordPress中的帖子和页面 。 如果您不想使用前两种方法,那么这种方法将允许您控制所有用户的帖子和页面的可见性。
影片教学 (Video Tutorial)
If you don’t like the video or need more instructions, then continue reading.
如果您不喜欢该视频或需要更多说明,请继续阅读。
方法1:使用Yoast SEO从搜索引擎隐藏WordPress页面 (Method 1: Hide a WordPress Page from Search Engines Using Yoast SEO)
This method is easier and recommended for beginners.
这种方法比较简单,建议初学者使用。
First thing you need to do is install and activate the Yoast SEO plugin. For more details, see our step by step guide on how to install a WordPress plugin.
您需要做的第一件事是安装并激活Yoast SEO插件。 有关更多详细信息,请参阅有关如何安装WordPress插件的分步指南。
If you are new to Yoast SEO, then you may want to see our guide on how to install and set up Yoast SEO plugin.
如果您不熟悉Yoast SEO,则可能需要查看有关如何安装和设置Yoast SEO插件的指南。
Next, you need to edit the post or page that you want to hide from search engines. Scroll down to the Yoast SEO meta box below the post editor and click on the advanced settings button.
接下来,您需要编辑要从搜索引擎中隐藏的帖子或页面。 向下滚动到帖子编辑器下方的Yoast SEO元框,然后单击高级设置按钮。
The advanced settings section allows you to add meta tag robots to your blog posts or pages. Using the robots meta tag, you can tell search engines not to index or follow a page.
高级设置部分允许您将元标记自动程序添加到博客文章或页面。 使用漫游器元标记,您可以告诉搜索引擎不要索引或关注页面。
First you need to select ‘noindex’ from the drop down menu next to ‘Meta robots index’ option. After that, click on ‘nofollow’ next to ‘Meta robots follow’ option.
首先,您需要从“元机器人索引”选项旁边的下拉菜单中选择“ noindex”。 之后,点击“元机器人跟随”选项旁边的“ nofollow”。
You can now save/publish your post or page.
您现在可以保存/发布您的帖子或页面。
Yoast SEO will now add this line of code to your post or page:
Yoast SEO现在会将以下代码行添加到您的帖子或页面:
<meta name="robots" content="noindex,nofollow"/>
This line simply tells search engines not to follow or index this page.
该行仅告诉搜索引擎不要关注此页面或对该页面建立索引。
方法2:使用robots.txt文件从搜索引擎隐藏WordPress页面 (Method 2: Hide a WordPress Page from Search Engines Using robots.txt File)
This method requires you to edit the robots.txt file. Adding incorrect instructions in this file can have adverse affect on your site’s SEO, which is why it is not recommended for beginner users.
此方法需要您编辑robots.txt文件。 在此文件中添加错误的说明可能会对您站点的SEO产生不利影响,因此不建议初学者使用。
The robots.txt file is a configuration file that you can add to your WordPress site’s root directory. It allows a website to provide instructions for search engine bots, hence the name robots.txt.
robots.txt文件是一个配置文件,您可以将其添加到WordPress网站的根目录中。 它允许网站为搜索引擎机器人提供说明,因此名称为robots.txt。
For more information, take a look at our guide on how to optimize your WordPress robots.txt for SEO.
有关更多信息,请参阅我们的指南, 了解如何针对SEO优化WordPress robots.txt 。
You can edit robots.txt file by connecting to your website using an FTP client or ‘File Manager’ in your WordPress hosting cPanel.
您可以通过使用FTP客户端或WordPress托管 cPanel中的“文件管理器”连接到您的网站来编辑robots.txt文件。
You will need to add these lines to your robots.txt file.
您需要将这些行添加到robots.txt文件中。
User-agent: *
Disallow: /your-page/用户代理: *
禁止:/您的页面/
The user-agent line allows you to target specific bots. We are using asterisk sign to include all search engines.
用户代理行允许您定位特定的机器人。 我们使用星号将所有搜索引擎包括在内。
The next line defines the part of the URL that comes after your domain name.
下一行定义了域名后面的URL部分。
Now let’s assume that you want to hide a blog post with a URL like this:
现在,假设您要隐藏具有以下URL的博客文章:
http://example.com/2016/12/my-blog-post/
http://example.com/2016/12/my-blog-post/
Here is how you will add this URL to your robots.txt file.
这是将这个网址添加到robots.txt文件中的方法。
User-agent: *
Disallow: /2016/12/my-blog-post/用户代理: *
禁止:/ 2016/12 / my-blog-post /
Don’t forget to save your changes and upload robots.txt file back to your server.
不要忘记保存您的更改并将robots.txt文件上传回您的服务器。
Disadvantages of Using robots.txt to Hide Content
使用robots.txt隐藏内容的缺点
First you need to keep in mind that robots.txt file is publicly accessible. Anyone can access it directly to see if there are any pages you are trying to hide.
首先,您需要记住,robots.txt文件是可公开访问的。 任何人都可以直接访问它以查看是否有任何页面要隐藏。
While most search engines follow the instructions in robots.txt file, many other crawlers and bots may simply ignore it. These are the bots crawling the web to spread malware, target websites, or harvest information like email accounts, phone numbers, etc.
尽管大多数搜索引擎都遵循robots.txt文件中的说明,但许多其他抓取工具和漫游器可能只是忽略了它。 这些是机器人在网上爬行以传播恶意软件,定位网站或收集诸如电子邮件帐户,电话号码等信息。
方法3:用密码保护WordPress中的帖子或页面 (Method 3: Password Protect a Post or Page in WordPress)
This method uses a different approach. Instead of asking search engines not to index a page, you can password protect it, so that it is only visible to users with the password.
此方法使用不同的方法。 您可以使用密码保护页面,而不用要求搜索引擎不要为页面编制索引,这样只有具有密码的用户才能看到该页面。
WordPress comes with a built-in feature to password protect posts and pages. Simply edit the post or page that you want to protect.
WordPress具有内置功能,可以用密码保护帖子和页面。 只需编辑您要保护的帖子或页面即可。
Under the publish meta box, click on the ‘Edit’ link next to ‘Visibility’ option.
在发布元框下,单击“可见性”选项旁边的“编辑”链接。
This will show the visibility options available in WordPress. You can keep a post/page public, make it private, or password protect it.
这将显示WordPress中可用的可见性选项。 您可以将帖子/页面设为公开,将其设为私有,或用密码保护它。
Private posts are only available to logged in users who have at least editor user role on your website.
私人帖子仅适用于在您的网站上至少具有编辑者角色的登录用户。
Password protected posts can be seen by any visitor who has the password. Click on password protected option and then enter a strong password.
拥有密码的任何访客都可以看到受密码保护的帖子。 单击受密码保护的选项,然后输入一个强密码。
You can now publish or save your post/page.
您现在可以发布或保存您的帖子/页面。
Now visitors accessing the post or page on your website will be asked to enter the password to view the content.
现在,访问您网站上的帖子或页面的访问者将被要求输入密码以查看内容。
For more detailed instructions, see our guide on how to password protect posts and pages in WordPress.
有关更多详细说明,请参阅有关如何在WordPress中对帖子和页面进行密码保护的指南。
That’s all, we hope this article helped you learn how to hide a WordPress page from Google. You may also want to see our guide on how to stop search engines from crawling a WordPress site.
就是这样,我们希望本文能帮助您学习如何从Google隐藏WordPress页面。 您可能还希望查看我们的指南,以了解如何阻止搜索引擎爬行WordPress网站 。
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
如果您喜欢这篇文章,请订阅我们的YouTube频道 WordPress视频教程。 您也可以在Twitter和Facebook上找到我们。
翻译自: https://www.wpbeginner.com/wp-tutorials/how-to-hide-a-wordpress-page-from-google/
wordpress谷歌字体