1

我已经将博客设置为根。然后按照http://refinerycms.com/guides/page-titles-and-urls上的教程进行操作,该教程说要更改 Refinery 的默认 slug,我需要修改config/initializers/refinery/pages.rbconfig.use_custom_slugs = true. 那部分已经完成。

我的博客将进入一个类似的子域,blog.example.com因此如果我有它看起来很糟糕blog.example.com/blog

所以我已经确保将“家”重定向到,www.example.com所以现在我需要知道如何/blog从 url 中删除。所以点击“博客”将带您到blog.example.com

在高级选项中,我尝试将自定义 slug 设置为“/”,但这并没有按预期工作。

在此处输入图像描述

4

3 回答 3

2

您需要更改您的 routes.rb 文件以重定向到博客索引页面。确保在安装炼油厂核心引擎之前放置它。

Yourapp::Application.routes.draw do

root :to => 'refinery/blog/posts#index'

# This line mounts Refinery's routes at the root of your application.
# This means, any requests to the root URL of your application will go to Refinery::PagesController#home.
# If you would like to change where this extension is mounted, simply change the :at option to something different.
#
# We ask that you don't use the :as option here, as Refinery relies on it being the default of "refinery"
mount Refinery::Core::Engine, :at => '/'
...
于 2015-01-20T01:49:25.140 回答
1

The Refinery Blog engine initializer has a "page_url" option you can change.

Uncomment the following line in config/initializers/refinery/blog.rb :

# config.page_url = "/blog"

And change it to

config.page_url = "/"

Not sure if this will work with a custom subdomain, but this is how to replace the default '/blog' route

于 2014-07-09T18:16:30.310 回答
0

我对炼油厂的内部结构不是很熟悉,但试着把它放在你的 routes.rb 文件的顶部:

get '/', to: redirect('/blog')

这应该允许您使用您想要的域,尽管我相信它会重定向到/blog渲染之前。

于 2013-09-05T02:28:09.083 回答