1

如何让我的根 URL 与相对链接一起使用?这个标签似乎不想指向正确的地方。

<%= link_to 'Home', '/' %>

我可以像这样在本地复制:

gem install middleman
middleman new site
cd site

echo "<%= link_to 'Home', '/' %>" > source/index.html.erb
echo "set :relative_links, true" >> config.rb
middleman build

# start webserver from the middleman root directory, not the build directory.
# This simulates a local url where the root url is not the `/`.

python -m SimpleHTTPServer &
open http://localhost:8000/build

您会看到“主页”链接返回到 / 而不是 /build,它是站点的相对主页。

4

1 回答 1

1

我能够<%= link_to '/index.html', 'Home' %>解决这个问题。

于 2017-06-01T23:04:21.543 回答