Landing Pages ブログ 🛩

Working, but no longer maintained [July 2022]

You can now use the Landing Pages Plugin to run a blog with Discourse :tada:. Set a category to be your blog, and the first post of every topic in that category will have its own blog page, and appear on a blog post list page.

Screen Shot 2021-05-13 at 5.04.18 PM

This project has been a joint effort between @meghna and myself. All of the nice design work is hers. If you like the design of this blog make sure to check our her Discourse Themes. Any bugs you find in the functionality are mine :slight_smile:

Get the code

GitHub-Mark-64px Landing Pages Plugin
GitHub-Mark-64px Blog Landing Pages
GitHub-Mark-64px Blog Landing Theme

See it in action

try.thepavilion.io/blog

Please note that all content on the blog and displayed in screenshots in this post is from The Conversation, and used under the Creative Commons License used by that site. All content belongs to its original authors and is used for demonstration purposes only.

How to set it up

Follow these steps in order

  1. Install the Landing Pages Plugin (how to install a plugin in Discourse).
  2. Install the Blog Landing Theme, (how to install a theme in Discourse).
  3. Set up the Blog Landing Pages as your landing pages repository.
  4. In the Landing Pages Administration UI change the category of the “Blog” page to whatever category you want to use to run your blog.

That’s it! The first post of every topic in that category will now be posts on your blog :slight_smile:

Restrict posting to contributors

You’ll probably want to restrict posting in that category to a group of blog contributors. If you’re not sure how to do that, here’s a quick guide

  1. Create a user group, e.g. “Contributors”, by going to /groups and clicking “New Group”
  2. Add users to the group (“Add Members” in the top right)
  3. In the blog category “Security” settings remove the “Create” permission from “Everyone”, and add your Contributors group

Now only your contributors can post on your blog, but everyone can comment on posts.

What makes this different from other blog solutions?

There’s some great existing solutions to running a blog inside or alongside Discourse, including

This is a bit different as it’s an entirely seperate set of pages that are not part of the Discourse client app, but it still uses the same server. This gives you a few advantages over running a seperate blog (e.g. on Wordpress), or using a Discourse category directly (e.g. with a theme component), including

  • You can create content and let users reply in Discourse, but have a dedicated blog environment for reading and sharing. Readers of your blog will feel like they’re reading a blog instead of a forum post.
  • You have a single user account system (Discourse’s)
  • You can use Discourse groups to restrict access to the blog
  • You can make Discourse posts appear as comments on your blog with no additional setup
  • You get nice responsive blog theme out of the box
  • You only have to set up, and pay for, one server
  • The blog doesn’t need to load your forum to work, so it can load quickly
  • You can easily keep your blog pages (and theme) in version control
  • You get a nicely formatted New Blog Post notification email (see below)
  • You can easily manage it alongside any other landing pages you need using the Landing Pages Plugin.

However, while the Blog Landing Pages have some clear advantages, they aren’t going to be the best community blog solution for everyone. You should test out the different solutions and see which one works for you.

What does it mean to “Subscribe” to the blog?

If you’re logged in and click the “Subscribe” button you’ll see a modal (if you’re logged out you’ll be redirected to Discourse login)

If you’ve checked the box next to “Subscribe to [site name]'s posts” and submitted the form, you’ll automatically be set to “Watching First Post” for the blog category. That means you’ll get an email notification every time there’s a new post in that category, like you would if you were subscribed to a blog!

You can also set your notifications for the blog category to “Watching First Post” in the normal way (in Discourse) and that will have the same effect. “Watching” the category (were you get an email for every post, including replies), also counts as being subscribed.

The email notifications for a blog category are a bit special. Firstly, unless you made the post yourself, you’ll always get an email notification if you’re subscribed, even if you visited the site recently. Secondly, they’re designed to look like a blog post email

We plan to allow a site admin to edit the blog post email html in the Landing Pages Administration UI in the near future. Note that if you’re “Watching” the blog category, only the email notification for the first post in each topic will be different. Notifications for replies will look like normal Discourse notifications.

Beyond blogging

You can use the functionality described above to create a set of landing pages for any content, like how Wordpress is a blogging engine that you can use for displaying other (non-blog) types of content. You could use a category to manage a set of products, places or people, and automatically get both a landing page and a discussion topic for the content, just by making a single post in Discourse.

Any developer who knows a bit of Ruby on Rails could achieve any of those additional use cases using this system. You don’t need to know how Discourse works. As these blog pages are part of the landing pages plugin, you also get access to all the existing templates in that plugin, including contact forms, header, footer, topic lists and user profiles. You can read more about these templates, and others, in the plugin documentation.

「いいね!」 41

Looks great, good job! Is the Blog Landing Theme a requirement? Would it be possibel in that case to have it as a component (since those who already have another/customized theme might want to stick with it)?

「いいね!」 2

The Blog Landing Pages, and the functionality in the Landing Pages Plugin they rely on, are both designed to work with any theme :slight_smile: You can customise this however you like.

It doesn’t need to be active on your Discourse site to work, it just needs to be installed, then selected in the relevant page in the Landing Pages Admin UI. This is what the theme settings look like on try.thepavilion.io (you can see the page settings in the OP)

「いいね!」 3

Epic! Excited to try this out. Thanks for this :slight_smile:

「いいね!」 2

:exploding_head:

This is really cool. Got me rethinking my entire approach. Thanks! :laughing:

「いいね!」 2

This is great!

For customizing, should I fork the repo to input my site’s info? Or is there a better way to do that?

「いいね!」 2

Thanks @sethm, yes the Blog Landing Theme and Blog Landing Pages are intended as templates, so you could:

  • import them directly into your instance as described above;
  • fork them; or
  • download them and modify them like you would with a template for Wordpress, Ghost etc.
「いいね!」 3

ディスコースコンテンツの一部を(このブログコンテンツのように)登録やログインなしで公開する方法はありますか?よろしくお願いします。

–ピーター

「いいね!」 1

ピーターさん、こんにちは。はい、デフォルトでは、Discourse のコンテンツはすべて公開されています。そうでない場合は、「ログイン必須」サイト設定が有効になっています。その後、カテゴリ固有の権限(カテゴリ設定内)を使用して、特定のカテゴリの表示を制御できます。上記のカテゴリ固有のアクセス設定のスクリーンショットを確認できます。

「いいね!」 1

すみません、カテゴリ固有のアクセス設定のスクリーンショットが見当たりません。

「いいね!」 1

何かお手伝いいただけますか?
もしかしたら、ログイン必須を削除しないと、カテゴリ固有の設定が表示されないのでしょうか?
しかし、カテゴリを公開またはログイン必須に設定するまで、それを削除したくありません…
ありがとうございます。

–ピーター

「いいね!」 1

カテゴリページにある管理レンチの「セキュリティ」タブからカテゴリの権限を表示できるはずです。

お役に立てば幸いです。 :slightly_smiling_face:

「いいね!」 2

ああ、ありがとう。
すべてのカテゴリと現在のユーザーを信頼レベル2に設定し、公開したい新しいカテゴリを信頼レベル0に設定し、ログイン必須を変更すれば、うまくいくということでしょうか?それとも、そのロジックは間違っていますか?

–ピーター

「いいね!」 1

ブログカテゴリを匿名ユーザーとアカウント保有者の両方に表示したい場合は、Everyoneグループを少なくとも「表示」に設定する必要があります。

その後、他のカテゴリを少なくともtrust_level_0に設定すると、ユーザーはそれらのトピックを表示および操作するためにアカウントが必要になります。

「いいね!」 1

ありがとうございました。うまくいきました。助かりました。

「いいね!」 2

このプラグインについて少し助けが必要です。一方では、次のように述べています。

カテゴリをブログとして設定すると、そのカテゴリの各トピックの最初の投稿が独自のブログページを持ち、ブログ投稿リストページに表示されます。

そして、もう一方では

  1. ブログランディングページをランディングページリポジトリとして設定します。

混乱しています。gitリポジトリや*html.erbファイルなしで、Discourseの投稿からブログを実行できますか?

「いいね!」 1

ブログのコンテンツは、ディスコースの投稿から取得されます。ブログのレイアウトはHTMLファイルで処理され、これらはブログランディングページリポジトリにある可能性があります。

このプラグインは、マークアップでブログ記事を作成するHugoとは異なります。これをHugoと統合するのはクールですが、いつか試すことができるかもしれません(@jumaguraさん、お願いします)。

「いいね!」 3

Discourse を使ってフォーラムを数ヶ月運営していますが、まだかなり新しいです。以前にもプラグインをインストールしたことがありますが、今夜 Landing Pages Plugin をインストールしようとしたところ、アプリの再構築時にエラーが発生し、起動しなくなりました。互換性やバージョンの問題かもしれませんが、どこから手をつければいいかわかりません。何かヒントをいただけますか?ログを遡って確認しましたが、問題の原因がわかりません。

以下は、再構築の結果の最後の部分です。

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 364 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
fb680c9c3b46dcd068abe877ed4187c730351c10139cc3eda2a8b7202822bf07
saul@discourseonubuntu2004-s-1vcpu-2gb-intel-lon1-01:/var/discourse$
saul@discourseonubuntu2004-s-1vcpu-2gb-intel-lon1-01:/var/discourse$

何か助けていただけると幸いです。

「いいね!」 1

このプラグインを確認してもらえませんか。私の上と同じ問題が発生しています。ビルドしようとするとエラーが発生します。明らかに、2.9.0 beta 4 以降、壊れているようです。

ログを提供することもできますが、作成者が新しい Discourse インストールを確認してからビルドを試みる方が良いでしょう。既存の Discourse インストールと新しいインストールの両方でテストしましたが、ビルドは常に失敗します。

最初の投稿で提供された手順に正確に従いました。

  1. Landing Pages Plugin をインストールします (Discourse にプラグインをインストールする方法)。
  2. Blog Landing Theme をインストールします (Discourse にテーマをインストールする方法)。
  3. Blog Landing Pages landing pages repository として設定します。
  4. Landing Pages Administration UI で、「Blog」ページのカテゴリをブログを実行するために使用したいカテゴリに変更します。
「いいね!」 1

来週中に、このプラグインを最新のDiscourseと互換性があるようにアップデートします。

「いいね!」 4