Create Partial Template with Data from Specific Markdown File

How can I create a partial template with data from specific markdown file?

I’m not exactly sure what you’re asking for, but this might be a good place to start:

Sorry, I am new to this.
I am trying to implement gallery on my homepage with hugo-easy-gallery and PhotoSwipe.
I have my code work but I don’t want to use _index.md to put my shortcode and use partial template to get data from _index.md file. I want partial template to get data from another md file. Then I add my partial template to in my index.html

I have the code like this…

data/homepage.yml

############################# Gallery ############################
gallery:
  enable : true

layouts/index.html

<!-- Gallery to action -->
{{ if $data.homepage.gallery.enable }}
{{ partial "gallery-pt.html" . }}
{{ end }}
<!-- /Gallery to action -->

partials/gallery-pt.html

<section class="page-title bg-2" style="background-image: url('{{.Params.Bg_image | absURL}}');">
  <div class="container">
    <div class="row">
      <div class="col-md-12">
        <div class="block">
          <h1>Gallery</h1>
          <p>{{ .Content }}</p>
        </div>
      </div>
    </div>
  </div>
</section>

content/_index.md

---
title: "Some title"
description: "some description"
draft: false
---
{{< load-photoswipe >}}
{{< gallery dir="images/gallery" >}}

I would like partial template, “gallery-pt.html”, to get “.Content” from another md file instead of “_index.md”.

Which page do you want get?

let say I put md file in content/gallery/gallery.md and have gallery-pt.html to get data from there.

Like I said, use https://gohugo.io/functions/getpage. The first example in the documentation is:

{{ with .Site.GetPage "/blog" }}{{ .Title }}{{ end }}

Replace /blog with whatever page you want, and replace .Title with .Content.

Where do we I add this code? in index.html? or partials template?

If you want gallery-pt.html to get the page, then use .GetPage in gallery-pt.html.

Please read the documentation.

It works!!
Thank you so much for your help!