{"id":20128172,"url":"https://github.com/thenewdynamic/hugo-module-tnd-seo","last_synced_at":"2025-06-13T05:32:28.790Z","repository":{"id":52202386,"uuid":"275831470","full_name":"theNewDynamic/hugo-module-tnd-seo","owner":"theNewDynamic","description":"An SEO Module by TND","archived":false,"fork":false,"pushed_at":"2022-10-02T06:29:07.000Z","size":54,"stargazers_count":8,"open_issues_count":8,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T11:17:08.944Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/theNewDynamic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-29T13:59:56.000Z","updated_at":"2024-09-08T16:44:30.000Z","dependencies_parsed_at":"2023-01-19T04:15:35.479Z","dependency_job_id":null,"html_url":"https://github.com/theNewDynamic/hugo-module-tnd-seo","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":"theNewDynamic/hugo-module-tnd-template-repo","purl":"pkg:github/theNewDynamic/hugo-module-tnd-seo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-seo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-seo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-seo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-seo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theNewDynamic","download_url":"https://codeload.github.com/theNewDynamic/hugo-module-tnd-seo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-seo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259589213,"owners_count":22880927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T20:25:58.909Z","updated_at":"2025-06-13T05:32:28.752Z","avatar_url":"https://github.com/theNewDynamic.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TND SEO Hugo Module\n\nHugo Module to quickly add sensible -- yet highly extendable -- SEO/opengraph metatags.\n\n## Requirements\n\nRequirements:\n\n- Go 1.14\n- Hugo 0.54.0\n\n## Installation\n\nIf not already, [init](https://gohugo.io/hugo-modules/use-modules/#initialize-a-new-module) your project as Hugo Module:\n\n```\n$: hugo mod init github.com/theNewDynamic/hugo-module-tnd-seo\n```\n\nConfigure your project's module to import this module:\n\n```yaml\n# config.yaml\nmodule:\n  imports:\n    - path: github.com/theNewDynamic/hugo-module-tnd-seo\n```\n\n## Usage\n\nDrop the following where appropriate\n\n```\n{{ if templates.Exists \"partials/tnd-seo/tags.html\" }}\n  {{ partial \"tnd-seo/tags.html\" . }}\n{{ end }}\n```\n\nThe above partials, will look for content information and build an Data object to be printed in SEO tags (og, twitter card etc...).\n\n### Add/Modify SEO Data\n\nThe module parses some data for each page in order to produce the right SEO tags.\nIf you need to alternate the data model, you can do so by adding to your project a `layouts/partials/tnd-seo/AddSEOData.html` partial and add to it as explained [here](/partials/AddSEOData.html).\n\nFrom the partial you can access the SEO Data model with `.seo`.\n\nHere is the Data model before user modification:\n\n```\ncanonical: String (ex: https://example.com/that-page)\ndescription: String\nimage: String\nimage_absolute: String (same as the above)\nimage_relative: String\njsonld: Map\nlocale: String (ex: en)\nprivate: Boolean\nsite_name: String\ntitle: String (ex: That Page | That Site)\ntranslations: Slice\n  - code: String\n    permalink: String\ntwitter_card: summary_large_image\ntype: website\n```\n\n### Example\n\nIn this example we need to focus our efforts on the site recipes and\n\n1. Use a custom parameter for the SEO description\n2. Prepend a CDN url to the relative value of the SEO image\n\n```\n{{/* layouts/partials/AddSEOData.html */}}\n{{ $s := newScratch }}\n{{ $s.Set \"seo\" dict }}\n\n{{ if eq .Type \"recipe\" }}\n  {{ with .Page.Params.recipe_incentive }}\n    {{ $s.SetInMap \"seo\" \"description\" . }}\n  {{ end }}\n  {{ with .seo.image_relative }}\n    {{ $s.SetInMap \"seo\" \"image\" (print \"https://assets.recipeyaya.com/images\" .) }}\n  {{ end }}\n{{ end }}\n\n{{/* Merge is important here as we want to overwrite the default data model with user's edits */}}\n{{ return merge .seo ($s.Get \"seo\") }}\n```\n\n### Settings\n\nSettings are added to the project's parameter under the `tnd_seo` map as shown below.\n\n```yaml\n# config.yaml\nparams:\n  tnd_seo:\n    # overrides .Site.Title\n    site_name: MyWebsite\n    # Used for articles without images\n    default_image: \"/images/default.jpg\"\n    # if true will use the SEO data object to output an json+ld script tag.\n    jsonld: true\n    disable_title_tag: false\n    # if true module will handle follow/nofollow tags for pages depending on environment and Front Matter setting.\n    enable_follow: false\n```\n\n#### Title tag\n\nMaybe website or theme handle their own `\u003ctitle\u003e` tag and removing it can be tricky. Even though by default the Module will handle the tag for your, you can prevent such behaviour by adding `disable_title` to the settings.\n\n\n#### Private pages\n\nIf the configuration value of `enable_follow` is set to `true`, the site's meta robots tags will be set for the site to be discoverable:\n\n```\n\u003cmeta content=\"index, follow\" name=robots\u003e\n```\n\nThis setting can be overridden on a page-by-page-basis with the following front matter:\n\n```\nseo:\n  private: true\n```\n\nThe page above, when in production will sport the nofollow/noindex meta tag.\n\n```\n\u003cmeta content=\"noindex, nofollow\" name=robots\u003e\n```\n\nAlternatively, you can set all pages to be private using Hugo's [front matter cascade](https://gohugo.io/content-management/front-matter#front-matter-cascade):\n\n```\ncascade:\n  seo:\n    private: true\n```\n\nNote: If `enable_follow` is set to `true`, the module will print a `nofollow, noindex` tag for every pages unless\n\n- The environment variable `HUGO_ENV` value is `production`  \n  AND\n- `seo.private` is not set or equals to `false`\n\n### Front Matter\n\nSome values generated by the Module's logic can be overwritten using the `seo` Front Matter map.\n\n```\n---\ntitle: Out of context\ndescription: That's dull!\nseo:\n  title: Intersting Title\n  image: /uploads/way-better-that-this-post-featured.png\n  description: A catchy phrase.\n```\n\n### Extend SEO Data\n\nIn order to customize the SEO Data consumed by Hugo to build the tags. User can create on the project level a `tnd-seo/AddSEOData` partial.\n\n## theNewDynamic\n\nThis project is maintained and loved by [thenewDynamic](https://www.thenewdynamic.com).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenewdynamic%2Fhugo-module-tnd-seo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthenewdynamic%2Fhugo-module-tnd-seo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenewdynamic%2Fhugo-module-tnd-seo/lists"}