{"id":17025778,"url":"https://github.com/AnirudhRahul/Reddit-Embed","last_synced_at":"2026-04-11T02:30:17.046Z","repository":{"id":57349574,"uuid":"298105158","full_name":"AnirudhRahul/Reddit-Embed","owner":"AnirudhRahul","description":"Embed any reddit post onto your website!","archived":false,"fork":false,"pushed_at":"2021-06-11T20:31:26.000Z","size":3269,"stargazers_count":22,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-09-14T23:06:47.460Z","etag":null,"topics":["client-side","embed-comments","gh-pages-demo","javascript","reddit","reddit-client","reddit-post"],"latest_commit_sha":null,"homepage":"https://anirudhrahul.github.io/Reddit-Embed/","language":"CSS","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/AnirudhRahul.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-09-23T22:05:36.000Z","updated_at":"2024-08-30T22:22:43.000Z","dependencies_parsed_at":"2022-09-15T15:23:07.402Z","dependency_job_id":null,"html_url":"https://github.com/AnirudhRahul/Reddit-Embed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhRahul%2FReddit-Embed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhRahul%2FReddit-Embed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhRahul%2FReddit-Embed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnirudhRahul%2FReddit-Embed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnirudhRahul","download_url":"https://codeload.github.com/AnirudhRahul/Reddit-Embed/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219847858,"owners_count":16556341,"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":["client-side","embed-comments","gh-pages-demo","javascript","reddit","reddit-client","reddit-post"],"created_at":"2024-10-14T07:29:59.342Z","updated_at":"2026-04-11T02:30:17.005Z","avatar_url":"https://github.com/AnirudhRahul.png","language":"CSS","funding_links":[],"categories":["CSS"],"sub_categories":[],"readme":"\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/AnirudhRahul/Reddit-Embed/blob/master/header.png?raw=true\" height=\"60px\"/\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://www.npmjs.com/package/reddit-embed\"\u003e\n    \u003cimg src=\"https://badge.fury.io/js/reddit-embed.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/AnirudhRahul/Reddit-Embed/blob/master/LICENSE\"\u003e\n      \u003cimg src=\"https://img.shields.io/apm/l/atomic-design-ui.svg\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"http://makeapullrequest.com\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat)\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\n\u003cp align=\"center\"\u003e\nA javascript plugin that lets you natively embed reddit posts/comments onto any website\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"https://github.com/AnirudhRahul/Reddit-Embed/blob/master/reddit_embed_example_2.png?raw=true\" style=\"max-height:500px\"/\u003e\n\u003c/p\u003e\n\n\n## Features\n* No Reddit API key needed!\n\n* No installation necessary, works perfectly through a CDN\n\n* Easily customizable color palette\n\n* Client-side rendered\n\n* Easy to use\n\n## Installation\n\nVia [npm](https://www.npmjs.com/package/reddit-embed):\n\n```\nnpm install reddit-embed\n```\n\n```HTML\n\u003clink rel=\"stylesheet\" href=\"node_modules/reddit-embed/css/red.css\"/\u003e\n\u003clink rel=\"stylesheet\" href=\"node_modules/reddit-embed/css/light-theme.css\"/\u003e\n\u003cscript src =\"node_modules/reddit-embed/dist/bundle.min.js\"\u003e\u003c/script\u003e\n```\n\n\nVia CDN:\n\n```HTML\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/reddit-embed@1.1.2/css/red.css\"/\u003e\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/reddit-embed@1.1.2/css/light-theme.css\"/\u003e\n\u003cscript src =\"https://cdn.jsdelivr.net/npm/reddit-embed@1.1.2\"\u003e\u003c/script\u003e\n```\n\n## Demos\n\n* https://anirudhrahul.github.io/Reddit-Embed/\n\n* https://anirudhrahul.github.io/Reddit-Embed/demos/basic_demo.html\n\n## Testing\n\nIf you want to see what a variety of different posts look like when they are embedded I would recommend checking out [test_links.md](https://github.com/AnirudhRahul/Reddit-Embed/blob/master/test_links.md)\n\n\n# Documentation\n\n## Getting Started\nFirst your need to find a reddit post you want to embed.\nOnce you have found a post copy the url and add /about.json to the end so it looks something like this:\n\n`https://www.reddit.com/r/pics/comments/7pnxv2/meeting_keanu_reeves_at_a_traffic_light/about.json`\n\nThen you can just add this markup to your website with your own `red-href`, `red-title`, `red-author` attributes filled in\n\n```HTML\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/reddit-embed@1.1.2/css/red.css\"/\u003e\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/reddit-embed@1.1.2/css/light-theme.css\"/\u003e\n\u003cscript src =\"https://cdn.jsdelivr.net/npm/reddit-embed@1.1.2\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  window.onload = red.embedAll\n\u003c/script\u003e\n\u003cdiv class=\"reddit-embed center\" red-author=\"keanu_reeves\"\nred-title=\"Meeting Keanu Reeves at a traffic light\"\nred-href=\"https://www.reddit.com/r/pics/comments/7pnxv2/meeting_keanu_reeves_at_a_traffic_light/about.json\" \u003e\u003c/div\u003e\n\n```\nNote that we have to import light-theme.css because red.css defaults to a dark theme with white text\n\nIf you want a similar basic example, with some more detailed documentation go  to [basic-demo.html](https://github.com/AnirudhRahul/Reddit-Embed/blob/master/demos/basic_demo.html)\n\nIf you want an even more advanced example you can take a look at the [source for the GH pages demo](https://github.com/AnirudhRahul/Reddit-Embed/blob/master/index.html)\n\n## Methods\n### `red.embed(url, div, opts = defaults)`\n* `url` : absolute url that points to an about.json file for a reddit post\n* `div` : javascript DOM element that we want to add content to\n* `opts`: optional argument, specifying any options we want to override from the defaults\n\nSends an xhr request to get the json file from `url`\n\nAnd then renders the content received onto `div`\n\n### `red.embedAll()`\nLoops through reddit-embed divs, and calls `red.embed` on them if they have a valid link in their `red-href` attribute.\n\nAlso note that a `red-opts` attribute containing a JSON object of options to override from default is also supported.\n\nNote that this function should only be called after a page's HTML has finished loading\n\n### `red.setDefaults(newDefaults)`\n* `newDefaults`: An object containing all or some of the options specified in the section below\n\nCan be called before a page is finished loading\n\n\n## Options\n*  `show_loading_animation: true`\n\t* Type: Boolean\n*  `post_title: false`\n\t* Type: false or String\n\t* If this value is set to a string then it will override the title of the post\n\t* Can be useful if you want to prevent content jumping\n\t* Can be set through the `red-title` attribute if using `res.embedAll()`\n*  `post_author: false`\n\t* Type: false or String\n\t* If this value is set to a string then it will override the name of the post author\n\t* Can be set through the `red-author` attribute if using `res.embedAll()`\n*  `show_post: true`\n\t* Type: Boolean\n\t* Overrides all other show_post options if set to false\n*  `show_post_title: true`\n\t* Type: Boolean\n*  `show_post_header: true`\n\t* Type: Boolean\n*  `show_post_body: true`\n\t* Type: Boolean\n*  `show_comments_section: true`\n\t* Type: Boolean\n\t* Overrides all other show_comments_section options if set to false\n*  `show_comments_section_header: true`\n\t* Type: Boolean\n*  `ignore_sticky_comments: false`\n\t* Type: Boolean\n\t* Will skip any stickied comments in the render queue\n*  `max_depth: -1`\n\t* Type: Integer\n\t* Will only render comments with a depth \u003c= max_depth, note that depth is 0 indexed so max_depth=0 will render the top layer of comments\n\t* max_depth is ignored if its \u003c 0\n*  `open_links_in_new_tab: true`\n\t* Type: Boolean\n*  `padding_per_depth: 24`\n\t* Type: Integer\n\t* Horizontal spacing in px between each layer of comments\n*  `initial_padding: 4`\n\t* Type: Integer\n\t* Horizontal spacing in px for first layer of comments\n*  `improve_spoiler_links: true`\n\t* Type: Boolean\n\t* Adds a Visual indicator for spoiler links\n\n\t![Spoiler Link Demonstration](https://media.giphy.com/media/3TxpzkvjxlSSm97ROw/giphy.gif)\n\n\n  Note if you want to quickly try out different options you can use the `Settings` button on the [GH pages demo](https://anirudhrahul.github.io/Reddit-Embed/)\n\n\n\n\n\n## Styling Tips\nSome css attributes you may want to override are:\n```css\n/* Max width for reddit-embed  div*/\n.reddit-embed {\n  max-width: 800px;\n}\n\n.reddit-embed img{\n\tmax-height: 840px;\n}\n\n.reddit-embed video[poster]{\n\tmax-height: 720px;\n}\n```\nThese values were chosen because they closely resemble the size of their respective elements on reddit, but these defaults may not be the best fit for your website\n\n\n## Color Palettes\nMaking your own color palette for Reddit-Embed is as simple as creating a css file\n\nCreate a css file similar to [css/dark-theme.css](https://github.com/AnirudhRahul/Reddit-Embed/blob/master/css/dark-theme.css) or [css/light-theme.css](https://github.com/AnirudhRahul/Reddit-Embed/blob/master/css/light-theme.css) by modifying the colors of each css variable\n\nThen import your palette css file **after** red.css\n\n```HTML\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/reddit-embed/css/red.css\"/\u003e\n\u003clink rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/reddit-embed/css/light-theme.css\"/\u003e\n```\n\n## Unstrict CSS\nBy default red.css uses !important to ovveride any CSS selectors targeting elements within a .reddit-embed div, but if you don't want that behavior you can use unstrict-red.css\n\nNote that the max-width property for .reddit-embed divs can be overriden in red.css\n\n\n## Fork Ideas\n* Make a WordPress plugin that wraps this library\n\n## Use cases\n* Add reddit posts to your blog\n* Use reddit as the comment platform for your website\n* Use it in a browser extension to add reddit comments to other popular websites\n\n## Known Issues\n* Native reddit videos don't play any audio\n\n* Posts with multiple images or videos are not supported\n\n\n## Build Instructions\nMake sure you have node 12+ and npm 6+ installed in your environment.\n\n\nInstall the build dependecies by running:\n```\nnpm install\n```\nThen use the following command to build `bundle.js` and `bundle.min.js`\n```\nnpm run build\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnirudhRahul%2FReddit-Embed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FAnirudhRahul%2FReddit-Embed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FAnirudhRahul%2FReddit-Embed/lists"}