{"id":23366557,"url":"https://github.com/dmptrluke/django-structured-data","last_synced_at":"2025-04-10T14:02:17.691Z","repository":{"id":57422185,"uuid":"231703804","full_name":"dmptrluke/django-structured-data","owner":"dmptrluke","description":"A template tag to assist in adding structured data to views and models.","archived":false,"fork":false,"pushed_at":"2023-08-31T01:51:34.000Z","size":23,"stargazers_count":9,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T12:39:48.425Z","etag":null,"topics":["django","json-ld","opengraph","python"],"latest_commit_sha":null,"homepage":null,"language":"Python","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/dmptrluke.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":"2020-01-04T03:38:07.000Z","updated_at":"2024-10-15T12:20:53.000Z","dependencies_parsed_at":"2022-09-06T14:01:50.642Z","dependency_job_id":null,"html_url":"https://github.com/dmptrluke/django-structured-data","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmptrluke%2Fdjango-structured-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmptrluke%2Fdjango-structured-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmptrluke%2Fdjango-structured-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmptrluke%2Fdjango-structured-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmptrluke","download_url":"https://codeload.github.com/dmptrluke/django-structured-data/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248230593,"owners_count":21069166,"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":["django","json-ld","opengraph","python"],"created_at":"2024-12-21T14:16:32.784Z","updated_at":"2025-04-10T14:02:17.626Z","avatar_url":"https://github.com/dmptrluke.png","language":"Python","readme":"# Django Structured Data  [![PyPI](https://img.shields.io/pypi/v/django-structured-data)](https://pypi.org/project/django-structured-data/)\nTemplate tags to assist in adding structured metadata to views and models.\n\n## Install\n\n1.  Add \"structured_data\" to your `INSTALLED_APPS`:\n```python\nINSTALLED_APPS = [\n    ...\n    'structured_data',\n]\n```\n\n## Use\n\n### In models\nDefine a `structured_data` property on your models. This is written in a standard JSON-LD format. Included\n below is a complicated example.\n```python\n    @property\n    def structured_data(self):\n        url = SITE_URL + self.get_absolute_url()\n        data = {\n            '@type': 'BlogPosting',\n            'headline': self.title,\n            'author': {\n                '@type': 'Person',\n                'name': self.author\n            },\n            'datePublished': self.created.strftime('%Y-%m-%d'),\n            'dateModified': self.modified.strftime('%Y-%m-%d'),\n            'url': url,\n            'mainEntityOfPage': {\n                '@type': 'WebPage',\n                '@id': url\n            },\n        }\n        if self.image:\n            data['image'] = SITE_URL + self.image.url\n\n        return data\n\n```\n\n### In templates\nUse the `json_ld_for` template tag to render your structured data as JSON-LD.\n```djangotemplate\n{% load jsonld %}\n{% json_ld_for post %}\n```\n\nA second template tag, `og_for`, is also included. This attempts to translate your JSON-LD\ndata to Open Graph tags that can be read by Facebook, Twitter, Telegram\nand more.\n ```djangotemplate\n{% load opengraph %}\n{% og_for post %}\n```\n\nA third template tag, `meta_for`, will render the **description** field from\nyour JSON-LD data as a standard HTML meta description tag.\n ```djangotemplate\n{% load meta %}\n{% meta_for post %}\n```\n\n## License\n\nThis software is released under the MIT license.\n```\nCopyright (c) 2019-2024 Luke Rogers\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmptrluke%2Fdjango-structured-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmptrluke%2Fdjango-structured-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmptrluke%2Fdjango-structured-data/lists"}