我尝试从布局的内容部分推送一些标题参数。
我的内容:
-myTitle = "title"
== render :slim, :"_layouts/default" do #<<need to push myTitle
//dynamic content
section class="body" id="diashow_content" == render :html, :"_body/index"
//<!-- Modal -->
//-js
这是我的默认布局:
doctype html
html
head
== render :slim, :"_head/default" #<<need to push myTitle
body
//invisible content
div class="handy"
section id="curtain" class="static" == render :html, :"_partials/curtain"
section id="head" class="static" == render :html, :"_partials/head"
section id="content" class="dynamic"
== yield
section id="loading" class="static collapse" == render :html, :"_partials/loading"
section id="foot" class="static" == render :html, :"_partials/foot"
我的标题所在的默认头:
meta charset="utf-8"
meta http-equiv="Content-Type" content="text/html"
meta name="keywords" content="test, test2"
meta name="description" content="Ich teste nur"
meta name="robots" content="index,follow"
meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"
meta name="theme-color" content="#0E214F"
==slim :"_head/assets"
title #<< try to get myTitle attribute here
我希望这足够透明,为我不愉快的英语技能而努力。 谢谢!
答案 0 :(得分:0)
您需要将其定义为实例变量,以便在其他模板中可用。
- @myTitle = "title"