html主目录隐藏子目录,html – Middleman路径不在子目录上工作

所以,这是我的第一个中间人项目,我正在努力解决中间人管理链接的问题.

实际上,我已经在github页面上进行了设置.我的所有资产都在工作,所以我做对了,但由于网站位于子目录中,导致每个页面的路径都失败了.

基本上root / directoryname / index.html有效但每个链接都返回一个目录,所以我应该有root / directoryname / page.html我得到root / page.html.

这是我的config.rb的样子:

# Reload the browser automatically whenever files change

configure :development do

activate :livereload

end

# Methods defined in the helpers block are available in templates

# helpers do

# def some_helper

# "Helping"

# end

# end

set :css_dir, 'css'

set :js_dir, 'js'

set :images_dir, 'img'

# Build-specific configuration

configure :build do

# For example, change the Compass output style for deployment

activate :minify_css

# Minify Javascript on build

activate :minify_javascript

# Enable cache buster

activate :asset_hash

# Use relative URLs

activate :relative_assets

activate :directory_indexes

# Or use a different image path

# set :http_prefix, "/Content/images/"

end

activate :deploy do |deploy|

deploy.method = :git

# Optional Settings

# deploy.remote = "custom-remote" # remote name or git url, default: origin

# deploy.branch = "custom-branch" # default: gh-pages

# deploy.strategy = :submodule # commit strategy: can be :force_push or :submodule, default: :force_push

end

data.works.each do |item|

proxy "/references/#{item.clean}.html", "/work.html", :locals => { :code => item }, :ignore => true

end

helpers do

# Sets the html class to 'active' when the link url is equal to the current page being viewed.

# Use just like the link_to helper.

#

def magic_link_to(link, url, opts={})

current_url = current_resource.url

if current_url == url_for(url) || current_url == url_for(url) + "/"

opts[:class] = "active"

end

link_to(link, url, opts)

end

end

这是我的主菜单的样子:

你们有什么感想 ?我错过了什么?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值