.CurrentSection and .IsHome in a partial

In a partial called nested.html I have the code below

{{- $page := . -}}
{{- $Page := .page -}}
{{- $context := .context -}}

{{- with $Page -}}
  {{ $section := .CurrentSection }}
    {{  if .IsPage }} 
      <p>{{ $section.Title }}</p>
    {{ else if .IsSection}}
      <span><{{ $section.Title }}</span>
{{ else  if .IsHome }} 
  <span><{{ $section.Title }} | {{ site.Title }}</span>
{{- end -}}

{{- end -}}

At the top of the template I want the partial to appear, I add {{- $Page := . -}} then the partial somewhere in the template as {{ partial "nested" (dict "page" $Page "context" .) }}, This returns a result for section and single templates, but zero result for index template. A workaround I found was to add {{- $home := .home -}} below {{- $context := .context -}}, then below the code block above, I removed the .IsHome part and added this code after the last {{ end }} and called the partial in the index template as {{ partial "nested" (dict "home" .) }}

{{- with $home -}}
  {{ $section := .CurrentSection }}
      <span><{{ $section.Title }} | {{ site.Title }}</span>
{{- end -}}

I am not sure if this is how it should be, but a more elegant solution is welcome.