{"id":36978478,"url":"https://github.com/mrnebbi/craft-template-tools","last_synced_at":"2026-01-13T22:47:58.040Z","repository":{"id":36232377,"uuid":"40536698","full_name":"mrnebbi/craft-template-tools","owner":"mrnebbi","description":"Craft CMS Plugin to provide some extra functionality to Twig templates","archived":false,"fork":false,"pushed_at":"2018-09-14T07:23:25.000Z","size":24,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-01T05:26:46.812Z","etag":null,"topics":["craft-plugin","craftcms","craftcms-plugin","twig-extension"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/mrnebbi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-11T10:48:06.000Z","updated_at":"2018-09-14T07:20:36.000Z","dependencies_parsed_at":"2022-08-23T12:20:38.644Z","dependency_job_id":null,"html_url":"https://github.com/mrnebbi/craft-template-tools","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/mrnebbi/craft-template-tools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrnebbi%2Fcraft-template-tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrnebbi%2Fcraft-template-tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrnebbi%2Fcraft-template-tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrnebbi%2Fcraft-template-tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrnebbi","download_url":"https://codeload.github.com/mrnebbi/craft-template-tools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrnebbi%2Fcraft-template-tools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28403740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":["craft-plugin","craftcms","craftcms-plugin","twig-extension"],"created_at":"2026-01-13T22:47:57.911Z","updated_at":"2026-01-13T22:47:58.016Z","avatar_url":"https://github.com/mrnebbi.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Template Tools\n\n\n[![version 2.0.0](https://img.shields.io/badge/version-2.0.0-brightgreen.svg)](https://github.com/mrnebbi/craft-template-tools)\n\n\nA Craft plugin to provide twig filters to help with template building.\n\n***\nPlease note: As of version 2.0, I've removed the Query Strings functionality from template tools. Please use my [Query Strings plugin](https://github.com/mrnebbi/craft-query-strings).\n***\n\n## firstTag\n\nEasily add a class, ID, or other attribute to the first element of a specific type. Useful for adding a class to the first paragraph.\n\n### Add a class\n\n```\n{{ content|firstTag('classname') }}\n```\n\nBy default this adds a class name to the first P tag.\nAdd a `.` or `#` to set an ID or Class.\n\n### Add an ID\n\n```\n{{ content|firstTag('#idname') }}\n```\n\n### Add to a non paragraph\nSets a class name or ID to the first tag of a type specified by you. e.g.\n\n```\n{{ content|firstTag('classname','h2') }}\n```\nAdd a `.` or `#` to set an ID or Class.\n\n### Add custom attribute and value to a non paragraph\nSets a value for a specified attribute to the first tag of a type specified by you.\n```\n{{ content|firstTag('slider1','img','data-slider') }}\n```\n\n\n```\n{{ content|firstTag('lead','h2','data-heading') }}\n```\n\n\n\n## getFirstParagraph\n\nRetrieve the first paragraph from content.\n\n### Get paragraph only\n\n```\n{{ content|getFirstParagraph }}\n```\n\n### Get paragraph and remove P tags\n\nAdd a flag of true to remove the P tags from the content.\n\n```\n{{ content|getFirstParagraph(true) }}\n```\n\n\n## wrapLinesInTag\n\nThis wraps any lines in multiline text in a tag of your choosing.\n\n```\n{{ content|wrapLinesInTag('span') }}\n```\n\n## preserveQueryStrings\n\nRemoved Query Strings functionality. Please use my [Query Strings plugin](https://github.com/mrnebbi/craft-query-strings).\n\n~~The Preserve Query String filter allows you to add `|preserveQueryStrings` to any URL output in twig, and it will keep the query strings as they should appear in the URL.~~\n\n\n## getQueryStrings\n\nRemoved Query Strings functionality. Please use my [Query Strings plugin](https://github.com/mrnebbi/craft-query-strings).\n\n~~Pull an array of query strings from Craft. This gets around the problem of duplicated query string keys being lost, turning them into an array you can loop through.~~\n\n~~An array will be returned with objects. Use `.key` and `.value`.~~\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrnebbi%2Fcraft-template-tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrnebbi%2Fcraft-template-tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrnebbi%2Fcraft-template-tools/lists"}