htmlmeta-hub


Namehtmlmeta-hub JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://github.com/jvanasco/htmlmeta_hub
SummaryLightweight support for managing metadata on webpages.
upload_time2023-06-08 19:34:50
maintainer
docs_urlNone
authorJonathan Vanasco
requires_python
licenseMIT
keywords metadata html web pyramid
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            htmlmeta_hub
============

Build Status: ![Python package](https://github.com/jvanasco/htmlmeta_hub/workflows/Python%20package/badge.svg)

`htmlmeta_hub` offers lightweight support for managing metadata on webpages.

This package simply and conveniently manages a dict of "metadata"", and renders
it appropriately.

There are helpers for the Pyramid framework which will attach the metdata object
to a request, allowing you to build up metadata throughtout the request cycle
and then finally render.

A typical way to use this package in the Pyramid framework:


Include this package in your application's  `__init__.py`:

	def main(global_config, **settings):
		...
		# custom htmlmeta
		config.include("htmlmeta_hub.pyramid_helpers")


If you are using "class based views", you can set some default metadata in a core
handler:

	class Handler(object):
		def __init__(self,request):
			self.request = request
			# set some defaults
			self.reqesut.htmlmeta.set_many(\
				title="MyApp",
				description="awesome",
				keywords="fun!",
			)

and then you can add specific metadata in each view's handler:

	class ContentPage(Handler):
		def view(self):
		    content= ...
			self.request.htmlmeta.set('title', content.title)
			self.request.htmlmeta.set('description', content.description)

In a template, such as this `page.mako` example, you can access specific bits of
the metadata, or render an entire payload:

	<title>${request.htmlmeta.get('title')|n}</title>
	${request.htmlmeta.as_html()|n}


Pyramid helpers existed until version `0.3.x` but were dropped in favor of the
`@reify` request method offered by the `config.include` method.

Pylons helpers existed until version `0.1.2` but were dropped.



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/jvanasco/htmlmeta_hub",
    "name": "htmlmeta-hub",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "metadata html web pyramid",
    "author": "Jonathan Vanasco",
    "author_email": "jonathan@findmeon.com",
    "download_url": "https://files.pythonhosted.org/packages/1b/75/7a589eb2292881f4d10132f32b10ea1e8fd7407e44b771766aebb7dcf490/htmlmeta_hub-0.5.0.tar.gz",
    "platform": null,
    "description": "htmlmeta_hub\n============\n\nBuild Status: ![Python package](https://github.com/jvanasco/htmlmeta_hub/workflows/Python%20package/badge.svg)\n\n`htmlmeta_hub` offers lightweight support for managing metadata on webpages.\n\nThis package simply and conveniently manages a dict of \"metadata\"\", and renders\nit appropriately.\n\nThere are helpers for the Pyramid framework which will attach the metdata object\nto a request, allowing you to build up metadata throughtout the request cycle\nand then finally render.\n\nA typical way to use this package in the Pyramid framework:\n\n\nInclude this package in your application's  `__init__.py`:\n\n\tdef main(global_config, **settings):\n\t\t...\n\t\t# custom htmlmeta\n\t\tconfig.include(\"htmlmeta_hub.pyramid_helpers\")\n\n\nIf you are using \"class based views\", you can set some default metadata in a core\nhandler:\n\n\tclass Handler(object):\n\t\tdef __init__(self,request):\n\t\t\tself.request = request\n\t\t\t# set some defaults\n\t\t\tself.reqesut.htmlmeta.set_many(\\\n\t\t\t\ttitle=\"MyApp\",\n\t\t\t\tdescription=\"awesome\",\n\t\t\t\tkeywords=\"fun!\",\n\t\t\t)\n\nand then you can add specific metadata in each view's handler:\n\n\tclass ContentPage(Handler):\n\t\tdef view(self):\n\t\t    content= ...\n\t\t\tself.request.htmlmeta.set('title', content.title)\n\t\t\tself.request.htmlmeta.set('description', content.description)\n\nIn a template, such as this `page.mako` example, you can access specific bits of\nthe metadata, or render an entire payload:\n\n\t<title>${request.htmlmeta.get('title')|n}</title>\n\t${request.htmlmeta.as_html()|n}\n\n\nPyramid helpers existed until version `0.3.x` but were dropped in favor of the\n`@reify` request method offered by the `config.include` method.\n\nPylons helpers existed until version `0.1.2` but were dropped.\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Lightweight support for managing metadata on webpages.",
    "version": "0.5.0",
    "project_urls": {
        "Homepage": "https://github.com/jvanasco/htmlmeta_hub"
    },
    "split_keywords": [
        "metadata",
        "html",
        "web",
        "pyramid"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1b757a589eb2292881f4d10132f32b10ea1e8fd7407e44b771766aebb7dcf490",
                "md5": "1549f5fa7289881912ea244dd7e9635b",
                "sha256": "37f7c75f75ddd96d214dba7dcbe2aded84e392be2899af260c9800b5681f2f7d"
            },
            "downloads": -1,
            "filename": "htmlmeta_hub-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1549f5fa7289881912ea244dd7e9635b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 7550,
            "upload_time": "2023-06-08T19:34:50",
            "upload_time_iso_8601": "2023-06-08T19:34:50.264210Z",
            "url": "https://files.pythonhosted.org/packages/1b/75/7a589eb2292881f4d10132f32b10ea1e8fd7407e44b771766aebb7dcf490/htmlmeta_hub-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-08 19:34:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jvanasco",
    "github_project": "htmlmeta_hub",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "htmlmeta-hub"
}
        
Elapsed time: 0.08931s