如何隐藏用户和搜索引擎不应直接访问的 Drupal 节点?
我见过很多类似的问题,但没有什么是我想要的。因此,冒着被告知这是重复的风险……就这样吧。
我发现有时我的节点只包含将在其他地方显示的内容,但不应直接查看。也就是说,任何人都不应该访问节点/1234,但节点 1234 中的内容应该显示在其他地方。
例如,我使用视图创建一个包含选项卡式内容的“关于”页面。所以有“关于我”、“关于我们”和“关于他们”页面。所有这些都使用视图显示在带有选项卡的单个页面中。因此,我不希望人们直接进入“关于我们”节点,因为这样他们就看不到其他页面的选项卡。同时,我不希望 Google 向人们提供到此节点的直接链接,我想限制访问,以便用户只能通过视图(即选项卡)访问它。
因此,我需要限制对该节点的访问,将其从 Drupal 搜索结果中删除,并确保 Google 不会发现它。有什么建议吗?
---- 注意 ----
我已经接受了 mingos 的答案(谢谢顺便说一句),因为尽管它不是一个完整的答案/解决方案,但它给了我一些值得思考的好东西。仍然欢迎其他答案。
I have seen many somewhat similar questions, but nothing quite what I'm looking for. So at the risk of being told this is a duplicate... here it goes.
I've found that there are times I have a node that simply contains content that will be displayed somewhere else, but shouldn't be viewed directly. That is, no one should ever go to node/1234, but the content in node 1234 should be displayed somewhere else.
For example, I create an about page with tabbed content using views. So there are "About Me", "About Us" and "About Them" pages. All of these are displayed in a single page with tabs using Views. So I don't want people to get directly to the "About Us" node because then they wouldn't see the tabs for the other pages. At the same time, I don't want Google giving people a direct link to this node, I want to limit access so users can only get to it through the View (i.e., the tab).
So I need to restrict access to the node, remove it from the Drupal search results, and make sure Google doesn't pick up on it. Any suggestions?
---- Note ----
I've accepted the answer from mingos (thanks btw) because even though it's not a full answer / solution, it gave me some good things to think about. Additional answers are still welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
在 Drupal 7 中,您可以使用: http://drupal.org/project/internal_nodes
描述:一些内容/决不应该直接查看节点;只能通过其他东西(例如视图或面板)可见。该模块拒绝访问节点/[nid] URL,同时允许内容保持发布状态并以其他方式查看。
全面披露:我是内部节点的创建者和共同维护者。我在搜索如何在 Google 上找到该模块时发现了这个问题。
In Drupal 7 you can use: http://drupal.org/project/internal_nodes
Description: Some content/nodes should never be viewed directly; only visible be through something else such as Views or Panels. This module denies access to node/[nid] URLs while allowing the content to stay published and otherwise viewable.
Full disclosure: I am the creator and co-maintainer of Internal Nodes. I found this question while searching to see how the module could be found on Google.
很难的一个。
如果你想要有很多像这样的节点并动态地“在其他地方显示”,我现在想不出任何东西(在凌晨 2:20 我很少能想到)。
如果有这样的页面(或很少),我会通过任何可用的方式(权限、节点访问、内容访问、TAC 等)限制对其的访问,然后为应显示受限制内容的页面创建特殊主题。主题将包含数据库查询,从受限节点获取内容。
其他可能性可能包括为相关隐藏节点创建一个特殊主题(也许都属于同一内容类型?)。使完整节点不显示任何内容(或显示一条消息,表示访问受到限制),并添加一个 ROBOTS 元标记,要求 Google 不要为该页面建立索引。使预告片视图可用 - 您可以在视图中自由显示它,但由于 /node/1234 是完整视图,因此实际内容在此处将不可用。
不知道这是否解决了您的问题,希望它至少有一点帮助。
Tough one.
If you want to have many nodes like this and do the "displaying elsewhere" dynamically, I can't think of anything right now (at 2:20 AM I rarely can).
If there is onne such page (or very few), I'd restrict access to it by any available means (Permissions, Nodeaccess, Content Access, TAC, whatever) and then create special themes for the pages where the restricted content should be displayed. The themes would contain database queries, fetching content from the restricted nodes.
Other possibility might include creating a special theme for the hidden nodes in question (perhaps all belonging to the same content type?). Make full node display nothing (or a message saying the access is restricted) and add a ROBOTS meta tag asking Google not to index the page. Make the teaser view available though - you can display it freely inside a view, but since /node/1234 is the FULL view, the actual content will be unavailable here.
Dunno if this solves your problem, hope it helps at least a bit.
我在遇到同样的问题后找到了这个页面。
我发现对我有用的内容可能是您需要的答案的一部分:
查看页面管理器重定向模块 http://drupal.org/project/page_manager_redirect。我刚刚开始玩它。
它使用 CTools 的页面管理器模块将一个页面重定向到另一页面。最强大的功能是页面管理器使用上下文。因此,如果您想重定向特定内容类型的所有页面,您可以这样做。
我刚刚开始使用它(而不是分类重定向和路径重定向)将特定词汇表的分类术语重定向(301 响应代码)到特定节点。
在您的实例中,您应该能够使用上下文来过滤特定页面。
当然,这并不能解决这些节点出现在搜索结果中的问题。
I found this page after running into this same problem.
What I found worked for me might be part of the answer you need:
Take a look at the Page Manager Redirect Module http://drupal.org/project/page_manager_redirect . I just started playing with it.
It uses the Page Manager module of CTools to redirect one page to another. What makes this most powerful is that Page Manager uses Contexts. So, if you want to redirect all pages of a particular content type, you can do so.
I just started to use it (instead of Taxonomy Redirect and Path Redirect) to redirect (301 response code) my taxonomy terms for a particular vocabulary to particular nodes.
In your instance, you should be able to use contexts to filter for specific pages.
Of course this doesn't solve the problem of these nodes coming up in search results.
还有另一个模块 Rabbit Hole 具有与 内部节点,但适用于所有实体,而不仅仅是节点。
There is also another module Rabbit Hole which has a similar functionality like Internal Nodes but works for all entities, not only nodes.
我遇到了同样的问题,目前正在考虑以下解决方案,其中节点的所有内容将显示给某些用户(基于权限):
- 取消发布节点
- 创建一个新的已发布复选框
- 创建一个包含显示所有内容的字段的视图
尚未对其进行彻底测试,但它似乎有效。
该节点将向创建者显示(权限1中仅显示一个),部分向权限2显示,全部向权限3显示。
对此解决方案的任何评论。
我认为这也会将其从搜索中排除,但权限 2 和 3 需要能够搜索它。还是没弄清楚这一点。
I am having the same problem, and are currently thinking of the following solution where all the content of a node is to be displayed to certain users (permission based):
- unpublish node
- create a new published checkbox
- create a view with fields that shows alle the content
Haven't tested it thoroughly yet, but it seems to work.
The node is to be displayed to the creator (only one in permission 1), some of it to permission 2 and all of it to permission 3.
Any comments on this solution.
I assume this will also exclude it from search, but permission 2 and 3 needs to be able to search it. Still haven't figured that one out.
我使用了带有“实体属于捆绑包”的规则模块和内置的“页面重定向”操作。
I used Rules module with an "entity is of bundle" and the built-in "Page redirect" action.
如果您只想通过视图显示内容类型,有一种非常简单的方法可以做到这一点。
该视图将允许匿名用户通过该视图访问内容,但他们无法通过直接链接访问未发布的内容内容。
There is a really easy way to do this if you only want to show a content type through a view.
the view will give anon users access to the content through the view but they won't have access to the unpublished content at the direct link to the content.