I'm using stash to fuel many parts of a site I am building. I successfully have it working to print certain parts of the page title to the tag of the page, but I want to include entry titles on pages where that is applicable. Here is my code setup for a given scenario:
This is my "main" template
{embed="_layout/events"}
{preload_replace:the_channel="events"}
{exp:stash:set_value name="title" value="Events"}
<!-- ???USE STASH APPEND FOR ENTRY PAGE TITLE???? -->
{exp:stash:set name="listing-content"}
<h1>Events</h1>
<p class="events-desc">{exp:low_variables:single var="lv_events_summary"}</p>
<div class="w-row">
{exp:channel:entries
channel="{the_channel}"
disable="categories|category_fields|member_data|pagination"
limit="3"
show_future_entries="yes"
sort="desc"
status="Open|Home"
}
<div class="w-col w-col-4 w-col-medium-4">
<a class="_97 card w-inline-block" href="/events/{url_title}">
<h4>{title}</h4>
{exp:channel_images:images entry_id="{entry_id}"}
<img class="event-cover" src="{image:url:card}" alt="{site_name} {seo}">
{/exp:channel_images:images}
{exp:chopper}{summary}{/exp:chopper}
</a>
</div>
{/exp:channel:entries}
</div>
{/exp:stash:set}
{exp:stash:set name="entry-content" parse_tags="yes"}
{exp:channel:entries
channel="{the_channel}"
disable="categories|category_fields|member_data|pagination"
limit="1"
show_future_entries="yes"
status="Open|Home"
url_title="{last_segment}"
}
{exp:stash:set_value name="page_title" parse_tags="yes" parse_depth="2" name="page_title"}
<h1>{title}</h1>
<div class="w-row">
<div class="w-col w-col-9 w-col-stack">
<blockquote>{summary}</blockquote>
</div>
</div>
<!-- /content -->
<div class="content-col-2 w-col w-col-3 w-col-stack">
<!-- sidebar -->
</div>
{/exp:channel:entries}
</div>
{/exp:stash:set}
This is my {embed="_layout/events"} template
{p_head}
<div class='content'>
{exp:switchee variable='{segment_1}/{segment_2}' parse='inward'}
{case value='{segment_1}/'}
{exp:stash:get name='listing-content'}
{/case}
{case default='Yes'}
{exp:stash:get name='entry-content'}
{exp:stash:get name='sidebar'}
{/case}
{/exp:switchee}
</div>
{p_footer}
And finally, here is my {p_head} file which is trying to reference the stashed element called "page_title" which is in the entry section of the main template:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{exp:stash:get name="title"}{exp:stash:get name="page_title" proces="end"} | {site_name}</title>
The stash:get for title works just fine, but the stash:get for page_title comes up blank. Any suggestions? Thanks!!!