Identify mounted posts in term

Is it possible to identify/differentiate posts which are mounted from standard posts, within a taxonomy term?

Details:

I have a section named “cardiff” and a section named “south-wales”.

Many of the posts in the section “south wales” are mounted from the “cardiff” section.

I would like to range through posts with a specific taxonomy term (across all regions), without rendering duplicates.

I was thinking, if I could somehow exclude mounted posts, this would solve my issue.

If this is not possible, I would appreciate suggestions for a workaround.

What do you mean when you say “mounted posts”?

Apologies, I am not clear on the correct terminology. I am using [[module.mounts]].

[[module.mounts]]
includeFiles = '/**'
excludeFiles = '/_index.md'
source = 'content/outdoor-activities/swansea/'
target = 'content/outdoor-activities/west-wales/'

OK, the term makes sense.

I think your current best/only option is to do simething ala:

{{ $isMount := false }}
{{ with .File }}
{{ $isMount = strings.Contains .Filename "swansea" }}
{{ end }}

… or something like that.

Please forgive my ignorance. I’m not clear how that works?

If I were to loop through all posts with a given taxonomy term, would it be possible to exclude posts which had been “mounted” into another section (“Swansea” into “West Wales”)?

For example, the following would show the same posts from both “Swansea” and “West Wales” and duplicates from “Cardiff” and “South Wales”:

{{ range (index .Site.Taxonomies.groups $venue) }}   
     [ some HTML ]
{{ end }}

Because the list of “mounted” cities could be quite large, it seems wise to avoid explicitly naming the cities in the code, but rather hugo recognizes which post type to ignore.

Of course, if it isn’t possible, I’ll have to work around it.

Then that’s it. I don’t understand your site and just threw in some advice from the side line.

Duplicating your pages anyhow seems a little odd. (Seo, user experience).

I would keep each in its folder an create a summary page that ranges over both sections.

Or a subfolder structure

Or taxonomies

Or …

But as @bep mentioned it’s currently hard to tell what you want.

That said, your architecture with cross mounting pages seems to hinder proper templating.