简体   繁体   中英

Pass Post data to application.html.ejs in geddy nodejs

im posting a form in geddy. i need to update my meta data according to posted data by the form, for this i have to pass post to

<%= partial('layout_header', {post: post}); %>
<div class="mainContain">
    <div class="container">
        <div class="wrapper">
            <% console.log(post.title); %>
            <%- displayFlash(flash); %>
            <%- render(); %>
        </div>
    </div>
</div>

for the above implementation i need my 'post' data on application.html.ejs.

thanks

Use Session variables to pass data to header and required page. i used this for dynamic meta tags.

=========================== EDIT ====================== in controller

self.respond({
               key: value,

               headerTags: {
                    "pageTitle": "title",
                    "h1Tag" : "h1"
               }
        });

and in application.html.ejs

<%= partial('layout_header', {session: session, headerTags : headerTags }); %>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM