Customize Consent Preferences

We use cookies to help you navigate efficiently and perform certain functions. You will find detailed information about all cookies under each consent category below.

The cookies that are categorized as "Necessary" are stored on your browser as they are essential for enabling the basic functionalities of the site. ... 

Always Active

Necessary cookies are required to enable the basic features of this site, such as providing secure log-in or adjusting your consent preferences. These cookies do not store any personally identifiable data.

No cookies to display.

Functional cookies help perform certain functionalities like sharing the content of the website on social media platforms, collecting feedback, and other third-party features.

No cookies to display.

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics such as the number of visitors, bounce rate, traffic source, etc.

No cookies to display.

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

No cookies to display.

Advertisement cookies are used to provide visitors with customized advertisements based on the pages you visited previously and to analyze the effectiveness of the ad campaigns.

No cookies to display.

Blogroll(お薦めリンク)を作成する

Blogrollという言葉を知った。日本ではあまり聞かないが、これはブログ用語で wikipedia によれば、

Blogroll
A list of blogs, usually placed in the sidebar of a blog, that reads as a list of recommendations by the blogger of other blogs.

ということで、つまり、「ブログのサイドバーなんかによく置かれる、ブロガーが推薦する他のブログのリスト」ということらしい。

これを実現してみた。例によって、参考にしたのは、Drupal.orgの以下のページである。(というより、そこに書いてあるまんまだけど)

個々のリンクを通常のノードで実現し、それをリストにして見るためのViewを別途作る、という方法でできる。できあがったものは左サイドバーに「お薦めリンク」というブロック名で置いた。(more…)をクリックすると ページView としてみることもできる。

上記のページはDrupal 5.x 向けに書かれている。このサイトでは 5.x で作成し、そのまま6.xに移行した。主な違いはViewsモジュールのバージョンの違いで、そこは以下で補足する。

  1. 以下の必要なモジュールを入れる(大抵はすでに入っていると思うが)
    • View
    • CCK (LinkモジュールとTextモジュールを入れておく)
  2. Blogrollの個々のリンク用のコンテンツタイプを追加する。
    • blogroll_item というコンテンツタイプを追加する
    • 名前は、Blogroll Itemでも”お薦めリンク”でも何でもいい。Typeは、blogroll_item とでもしておく。Title fieldはそのまま。Body(本体)は不要なのでブランクにする。
      Published (掲載)にチェック。フロントページには掲載しない。
      コメントと添付は無効にしておく。
    • 一旦保存してから、フィールドを追加する。Linkタイプのフィールドを追加し、名前をURLとでもしておく。必須フィールドにする。LinkタイトルはRequired。さらにテキストタイプのフィールドを追加する名前をDescriptionとでもしておく。行数はお好みで。必須フィールドにはしない。書式はPlainTextでもFilteredでも。
    • 保存したら、Manage Fieldsをクリックし、URL フィールドの重みを-1にしてテキストより上になるようにする。(6.xでは”フィールドの管理”からドラッグ&ドロップで簡単に順序を変えられるようになった)
    • Display Fieldsをクリックして、Teaser settingがDefault as linkになっていることを確認する。
  3. Blogroll ページ Viewを作成する。(以下では、ページ用のViewとブロック用のViewを別々に作っているが、6.xのViewsでは一つのViewを作成し、ページ用の表示とブロック用の表示というように別々に設定できるようになった)
    • 名前は、blogroll_pageとでも。
    • ページとして作る。
    • URLはblogrollとでもしておく。
    • View TypeはTable ViewかList View(このサイトではTable Viewにしている)。
    • 1ページの個数はお好みで。
    • フィールドはまず Link(URL)を追加する。HandlerはGroup Multiple Values、OptionはDefault as link。次にテキスト(Description)を追加する。HandlerはGroup Multiple Values、OptionはDefault。さらに、Node:Edit LinkとNode:Delete Linkを追加する。
    • フィルターは、Field Node Value is one of blogroll_item と Node Published is True でフィルターをかける。
    • ソートはお好みで。
  4. ここまでで、blogroll_item のコンテンツをいくつか作って、http://www.example.com/blogroll にアクセスすると blogroll のページができているはず。
  5. 次に、サイドバー用のブロックを作成する。先ほど作った ページ用のViewをブロック用にしてもよいが、そうするとリンクとテキストが両方出てきてしまう。
    なので、ブロック用のViewを別に作った方がよい。(ただし、上で書いたように6.xのViews2はページ用とブロック用の表示を分けて設定ができるのでViewは一つでよい)

    • 名前は、blogroll_block とでもする。
    • ブロック用のViewとして作る。
    • View TypeはList Viewにする。
    • タイトルは「お薦めリンク」とかなんとか。
    • 表示するリンクの数も適当に決める。
    • そして、(More) Linkは Noにしておき、フッターに先ほど作ったページ用のViewのURLを入れる。
    • フィールドはLink:URLだけにする。OptionはDefault as Link.
    • フィルターはページ用のViewと同じ。
    • ソートはお好みで。
  6. 最後に、ブロック用のViewを管理メニューのブロックのページから有効にして好きなところに置けばよい。

PAGE TOP