{"id":20128212,"url":"https://github.com/thenewdynamic/hugo-module-tnd-media","last_synced_at":"2026-03-19T14:02:36.583Z","repository":{"id":42622661,"uuid":"364583972","full_name":"theNewDynamic/hugo-module-tnd-media","owner":"theNewDynamic","description":"A catch-all solution for handling media in your Hugo project","archived":false,"fork":false,"pushed_at":"2022-10-04T16:22:54.000Z","size":35,"stargazers_count":0,"open_issues_count":7,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-06T03:05:32.894Z","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":"2021-05-05T13:21:58.000Z","updated_at":"2022-03-30T17:54:45.000Z","dependencies_parsed_at":"2023-01-19T03:00:15.249Z","dependency_job_id":null,"html_url":"https://github.com/theNewDynamic/hugo-module-tnd-media","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"theNewDynamic/hugo-module-tnd-template-repo","purl":"pkg:github/theNewDynamic/hugo-module-tnd-media","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-media","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-media/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-media/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-media/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/theNewDynamic","download_url":"https://codeload.github.com/theNewDynamic/hugo-module-tnd-media/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/theNewDynamic%2Fhugo-module-tnd-media/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29484656,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T15:33:17.885Z","status":"ssl_error","status_checked_at":"2026-02-15T15:32:53.698Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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:26:13.145Z","updated_at":"2026-02-15T16:33:26.904Z","avatar_url":"https://github.com/theNewDynamic.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Requirements\n\nRequirements:\n- Go 1.14\n- Hugo 0.61.0\n\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 {repo_url}\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-media\n```\n\n## Usage\n\n### API\n\nThe data returned by the following map is:\n\n- .Name\n- .Path\n- .Permalink\n- .RelPermalink\n- .Width ?\n- .Height ?\n\n### Get\n\nThe only available public returning partial is `Get`.\n\nIt returns the above structured data of the potentially transformed image.\n\nThis takes two types of arguments.\n- A file path | String (.)\n  With the above, the function simply returns some data on the image.\n- A map | Map (.)\n  path: A file path | String\n  ...any other key will match a transformation from the hugo or other service API and its value the property to be passed.\n  With the above, the function returns the data of the transformed media.\n\n#### Examples\n```\n{{ $path := \"/uploads/an-image.jpg\" }}\n{{ with partial \"tnd-media/Get\" $path }}\n  {{ $url = .RelPermalink }}\n{{ end }}\n```\n\n```\n{{ $args := dict \n  \"path\" \"/uploads/an-image.jpg\" \n  \"width\" 1024 \n  \"height\" 100 \n}}\n{{ with partial \"tnd-imgix/Get\" $args }}\n  {{ $url = .RelPermalink }}\n{{ end }}\n```\n\n### Transformations\n\nWhile transformation are passed as parameter to the `Get` function, the Module can either use Hugo's built-in [Image processing solution](https://gohugo.io/content-management/image-processing/#readout) or [imgix](https://www.imgix.com/)\n\nWhile Hugo's built-in solution gives more than you usually need on any given project, imgix sports more transformations options.\n\nAvailable transformation options are:\n\n#### With Hugo or Imgix\n- width (int)\n- height (int)\n- crop (bool)\n- format (jpg|png|tif|bmp|gif|webp)\n- quality (int [0-100])\n- rotate (int [0-360])\n\n#### With Imgix\nAll of the above plus any options available through their [Image rendering API](https://docs.imgix.com/apis/rendering) not listed above.\n\n### Settings\n\nSettings are added to the project's parameter under the `tnd_media` map as shown below.\n\n```yaml\n# config.yaml\nparams:\n  tnd_media:\n    storage: bundle\n```\n\n#### storage\n\nWhen an image is referenced as `/uploads/image.jpg` the module and its `Get` function needs to know if it lives in the project's assets under `/assets/uploads/image.jpg` or in a headless bundle at `content/uploads/image.jpg` or in the static directory `/static/uploads/image.jpg`.\n\n- bundle\n- assets\n- static\n\nNote that while `bundle` and `assets` can both do Hugo image processing, `static` images cannot and will need imgix to be setup in order to be \"transformed\".\n\n#### Imgix\n\nOn top of using the built-in Hugo image transformation abilitym, the Module can also use the power of [TND Imgix](https://github.com/theNewDynamic/hugo-module-tnd-imgix).\n\nNote that using imgix, image transformed with the `Get` function will not return any `Width` or `Height`\n\n##### Set Up\nIn order to use imgix, you just need to set a imgix domain.\n\n```yaml\nparams:\n  tnd_media:\n    imgix:\n      domain: imgix.project.net\n# That's it 🎉\n```\n\nFor more advanced imgix configuration, head to the upstream documentation from [TND Imgix](https://github.com/theNewDynamic/hugo-module-tnd-imgix#settings) and store those keys alongside the above example under `params.tnd_media.imgix`\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-media","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthenewdynamic%2Fhugo-module-tnd-media","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthenewdynamic%2Fhugo-module-tnd-media/lists"}