# Reusable template code for page \<head\> tags (\<title\> and other)

**URL:** <https://discourse.gohugo.io/t/reusable-template-code-for-page-head-tags-title-and-other/32656>\
**Category:** support\
**Created:** [May 2, 2021, 6:29am UTC](https://discourse.gohugo.io/t/reusable-template-code-for-page-head-tags-title-and-other/32656 "2021-05-02T06:29:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![fairplay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fairplay/32/9884_2.png) [@fairplay](https://discourse.gohugo.io/u/fairplay)\
**Post date:** [May 2, 2021, 6:29am UTC](https://discourse.gohugo.io/t/reusable-template-code-for-page-head-tags-title-and-other/32656/1 "2021-05-02T06:29:02Z")

</div>

Construction in baseof.html

```auto
<title>{{ .Title }} > My Site</title>

```

works for single pages. But when it comes to taxonomies list pages `.Title` is empty. I need taxonomies pages to have taxonomy metadata as `<title>`. Let’s take example

config.toml

```auto
[taxonomies]
    author = "authors"

```

\_index.md in content/authors/jack-london

```auto
---
fullname: "Jack London"
---

```

Front matter of books by Jack London (yes, for some reasons I have to use already urlized names as tags)

```auto
authors:
- jack-london

```

First I need “Jack London” as `<title>` of `/authors/jack-london` page

```auto
{{ .Page.Params.fullname }} 

```

do the trick

Second I’d like code for `<title>` to be reusable for all pages. Logic something like

if page is single

{{ .Title }} else if page taxonomy {{ .Page.Params.fullname }}

Is it possible?

---

<div class="post-metadata">

**Author:** ![gethugothemes](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/gethugothemes/32/13287_2.png) [@gethugothemes](https://discourse.gohugo.io/u/gethugothemes)\
**Post date:** [May 2, 2021, 8:32am UTC](https://discourse.gohugo.io/t/reusable-template-code-for-page-head-tags-title-and-other/32656/2 "2021-05-02T08:32:06Z")

</div>

Have a look at how the documentation sets the base layout. The title is in a block and can be set by subsequent layout files.

> **[Base Templates and Blocks](https://gohugo.io/templates/base/#define-the-base-template)**
>
> The base and block constructs allow you to define the outer shell of your master templates (i.e., the chrome of the page).

This way you can add content to the title from further down the layouts by putting a `{{ define "title" }}` into your page layouts and then there locating the frontmatter variables you need in the title.

---

<div class="post-metadata">

**Author:** ![fairplay](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/fairplay/32/9884_2.png) [@fairplay](https://discourse.gohugo.io/u/fairplay)\
**Post date:** [May 3, 2021, 7:19am UTC](https://discourse.gohugo.io/t/reusable-template-code-for-page-head-tags-title-and-other/32656/3 "2021-05-03T07:19:54Z")

</div>

Oops, just haven’t read that page and didn’t found it by search. Thank you and sorry for obvious question.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)\
**Post date:** [May 5, 2021, 7:20am UTC](https://discourse.gohugo.io/t/reusable-template-code-for-page-head-tags-title-and-other/32656/4 "2021-05-05T07:20:22Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
