{"id":21770757,"url":"https://github.com/gouravkhunger/jekyll-url-metadata","last_synced_at":"2025-04-13T16:41:07.122Z","repository":{"id":45761644,"uuid":"514419900","full_name":"gouravkhunger/jekyll-url-metadata","owner":"gouravkhunger","description":"A jekyll plugin to expose meta data information of a webpage to liquid variables just from its url string.","archived":false,"fork":false,"pushed_at":"2024-10-31T03:31:38.000Z","size":62,"stargazers_count":9,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-07T04:07:30.033Z","etag":null,"topics":["hacktoberfest","jekyll","jekyll-plugin","ruby"],"latest_commit_sha":null,"homepage":"http://url-metadata.gourav.sh/","language":"Ruby","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/gouravkhunger.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-15T22:24:47.000Z","updated_at":"2025-01-23T14:48:20.000Z","dependencies_parsed_at":"2024-10-31T04:32:18.126Z","dependency_job_id":null,"html_url":"https://github.com/gouravkhunger/jekyll-url-metadata","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"343ac3cd47d25f4cc75dd1a0e8b93a94fce6f649"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gouravkhunger%2Fjekyll-url-metadata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gouravkhunger%2Fjekyll-url-metadata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gouravkhunger%2Fjekyll-url-metadata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gouravkhunger%2Fjekyll-url-metadata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gouravkhunger","download_url":"https://codeload.github.com/gouravkhunger/jekyll-url-metadata/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248746966,"owners_count":21155361,"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":["hacktoberfest","jekyll","jekyll-plugin","ruby"],"created_at":"2024-11-26T14:13:44.401Z","updated_at":"2025-04-13T16:41:07.100Z","avatar_url":"https://github.com/gouravkhunger.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Jekyll::URLMetadata\n\n[![Gem Version](https://img.shields.io/gem/v/jekyll-url-metadata)][ruby-gems]\n[![Gem Total Downloads](https://img.shields.io/gem/dt/jekyll-url-metadata)][ruby-gems]\n\n[ruby-gems]: https://rubygems.org/gems/jekyll-url-metadata\n\nA jekyll plugin to extract meta information from urls and expose them to liquid variables.\n\nThis gem was originally authored to be used as a custom plugin for the [static site](https://github.com/genicsblog/genicsblog.com) of [genicsblog.com](https://genicsblog.com)\n\n## Installation\n\nAdd this line to your application's Gemfile inside the `jekyll_plugins` group:\n\n```ruby\ngroup :jekyll_plugins do\n    # other gems\n    gem \"jekyll-url-metadata\"\nend\n```\n\nThen, enable the plugin by adding it to the `plugins` section in the `_config.yml` file:\n\n```yaml\nplugins:\n    # - other plugins\n    - jekyll-url-metadata\n```\n\nAnd then execute:\n\n```shell\nbundle install\n```\n\n## Usage\n\nThis plugin is essentially a filter and works on any [valid URL string](https://en.wikipedia.org/wiki/URL#Syntax) provided inside a liquid tag. Use it as below:\n\n```liquid\n{% assign meta = \"https://wikipedia.org\" | metadata %}\n```\n\nThe `metadata` filter extracts the meta data from the given url string and returns the data as a `Hash`.\n\nThese are the values that are extracted:\n\n- The `\u003ctitle\u003e` tag.\n- The `\u003cmeta\u003e` tags that have a `name`, `property` or `charset` fields.\n- The `\u003clink\u003e` tags with a `rel` attribute.\n\nThe expected output for `{{ meta }}` from the above example would be:\n\n```ruby\n{\n  \"title\" =\u003e \"Wikipedia\",\n  \"charset\" =\u003e \"utf-8\",\n  \"description\" =\u003e \"Wikipedia is a free online encyclopedia, created and edited by volunteers around the world and hosted by the Wikimedia Foundation.\",\n  \"viewport\" =\u003e \"initial-scale=1,user-scalable=yes\",\n  \"apple-touch-icon\" =\u003e \"/static/apple-touch/wikipedia.png\",\n  \"shortcut icon\" =\u003e \"/static/favicon/wikipedia.ico\",\n  \"license\" =\u003e \"//creativecommons.org/licenses/by-sa/3.0/\",\n  \"preconnect\" =\u003e \"//upload.wikimedia.org\"\n}\n```\n\n### Connection time-outs\n\nBy default, the connection request to the specified domain closes after about `1` second if there is an error.\n\nTo override the default behavior, add this block to the `_config.yml` file:\n\n```yml\nurl_metadata:\n  open_timeout: 5 # timeout after 5 second if connection doesn't open\n  read_timeout: 3 # timeout after 3 second if there's no data returned\n```\n\n\u003e **Note**: You may use any number for the timeout seconds, but generally a number less than `10` is ideal for better performance because the processing of the static pages is blocked until some data is returned from a website.\n\n### Caching\n\nOnce the initial data is returned from the website, the extracted parameters are stored in the `.jekyll-cache` folder under `Jekyll--URLMetadata` plugin cache folder.\n\nThe cache improves subsequent build times in the local development environment.\n\nIf you wish to purge the cache, simple delete the `Jekyll--URLMetadata` folder and the plugin will re-generate the cache in the next run.\n\n## Use cases\n\n- Creating beautiful social previews for links by fetching meta data for URLs at build time.\n- Determining meta data from a website at jekyll build time to evaluate and perform certain action.\n\nSee also the [example website](https://url-metadata.gourav.sh/) and\n[its source code](https://github.com/gouravkhunger/jekyll-url-metadata/tree/main/example).\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://github.com/gouravkhunger/jekyll-url-metadata/blob/main/LICENSE).\n\n```\nMIT License\n\nCopyright (c) 2022 Gourav Khunger\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgouravkhunger%2Fjekyll-url-metadata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgouravkhunger%2Fjekyll-url-metadata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgouravkhunger%2Fjekyll-url-metadata/lists"}