{"id":20313082,"url":"https://github.com/edoburu/django-capture-tag","last_synced_at":"2025-10-16T07:06:28.978Z","repository":{"id":57419226,"uuid":"56684352","full_name":"edoburu/django-capture-tag","owner":"edoburu","description":"A micro-library to capture output in Django templates","archived":false,"fork":false,"pushed_at":"2023-07-11T08:22:28.000Z","size":29,"stargazers_count":20,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-05T01:32:55.176Z","etag":null,"topics":["django","django-template-tag","microlibrary"],"latest_commit_sha":null,"homepage":"http://django-capture-tag.readthedocs.org","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edoburu.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-20T12:19:46.000Z","updated_at":"2024-08-21T20:17:14.000Z","dependencies_parsed_at":"2024-06-21T12:56:13.049Z","dependency_job_id":"5af4aa1d-d791-4f3f-94c9-3c9433dc78fc","html_url":"https://github.com/edoburu/django-capture-tag","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"f63533dd1a5ce3926c36e5795a3767ab4d7eb6fc"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoburu%2Fdjango-capture-tag","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoburu%2Fdjango-capture-tag/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoburu%2Fdjango-capture-tag/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edoburu%2Fdjango-capture-tag/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edoburu","download_url":"https://codeload.github.com/edoburu/django-capture-tag/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248443053,"owners_count":21104328,"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","django-template-tag","microlibrary"],"created_at":"2024-11-14T18:09:12.413Z","updated_at":"2025-10-16T07:06:23.924Z","avatar_url":"https://github.com/edoburu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"django-capture-tag\n==================\n\n.. image:: https://github.com/edoburu/django-capture-tag/actions/workflows/tests.yaml/badge.svg?branch=master\n    :target: https://github.com/edoburu/django-capture-tag/actions/workflows/tests.yaml\n.. image:: https://img.shields.io/pypi/v/django-capture-tag.svg\n    :target: https://pypi.python.org/pypi/django-capture-tag/\n.. image:: https://img.shields.io/pypi/l/django-capture-tag.svg\n    :target: https://pypi.python.org/pypi/django-capture-tag/\n.. image:: https://img.shields.io/codecov/c/github/edoburu/django-capture-tag/master.svg\n    :target: https://codecov.io/github/edoburu/django-capture-tag?branch=master\n\nA micro-library to capture output in Django templates.\n\nThis can be useful for example to:\n\n* Repeat page titles in web pages, e.g. for the ``\u003ctitle\u003e`` tag and breadcrumb.\n* Repeat contents for Social Media tags.\n* Reusing thumbnail output in multiple places.\n* Fetch configuration data from extended templates.\n\n\nInstallation\n------------\n\nInstall the module from PyPI:\n\n.. code-block:: bash\n\n    pip install django-capture-tag\n\nAdd the package to ``INSTALLED_APPS``:\n\n.. code-block:: python\n\n    INSTALLED_APPS += (\n        'capture_tag',\n    )\n\nLoad the tag in your template:\n\n.. code-block:: html+django\n\n    {% load capture_tags %}\n\n\nSyntax\n------\n\nThe following options are available:\n\n.. code-block:: html+django\n\n    {% capture %}...{% endcapture %}                    # output in {{ capture }}\n    {% capture silent %}...{% endcapture %}             # output in {{ capture }} only\n    {% capture as varname %}...{% endcapture %}         # output in {{ varname }}\n    {% capture as varname silent %}...{% endcapture %}  # output in {{ varname }} only\n\n\nExample usage\n-------------\n\nTo capture Social Media tags:\n\n.. code-block:: html+django\n\n    {% load capture_tags %}\n\n    \u003chead\u003e\n        ...\n\n        {# Allow templates to override the page title/description #}\n        \u003cmeta name=\"description\" content=\"{% capture as meta_description %}{% block meta-description %}{% endblock %}{% endcapture %}\" /\u003e\n        \u003ctitle\u003e{% capture as meta_title %}{% block meta-title %}Untitled{% endblock %}{% endcapture %}\u003c/title\u003e\n\n        {# display the same value as default, but allow templates to override it. #}\n        \u003cmeta property=\"og:description\" content=\"{% block og-description %}{{ meta_description }}{% endblock %}\" /\u003e\n        \u003cmeta name=\"twitter:title\" content=\"{% block twitter-title %}{{ meta_title }}{% endblock %}\" /\u003e\n    \u003c/head\u003e\n\nTake configuration from extended templates:\n\n.. code-block:: html+django\n\n    # base.html\n\n    {% load capture_tags %}\n\n    # read once\n    {% capture as home_url silent %}{% block home_url %}{% url 'app:index' %}{% endblock %}{% endcapture %}\n\n    # reuse twice.\n    \u003ca href=\"{{ home_url }}\" class=\"btn page-top\"\u003eBack to home\u003c/a\u003e\n    \u003ca href=\"{{ home_url }}\" class=\"btn page-bottom\"\u003eBack to home\u003c/a\u003e\n\n    # child.html\n    {% extends \"base.html\" %}\n\n    {% block home_url %}{% url 'user:profile' %}{% endblock %}\n\nNotice\n~~~~~~\n\nWhen a value is used only once, this package is not needed.\nIn such case, simply place the ``{% block .. %}`` at the proper location where contents is replaced.\nAll common Django template tags support the ``as variable`` syntax,\nsuch as ``{% url 'app:index' as home_url %}`` or ``{% trans \"Foo\" as foo_label %}``.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedoburu%2Fdjango-capture-tag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedoburu%2Fdjango-capture-tag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedoburu%2Fdjango-capture-tag/lists"}