{"id":19587731,"url":"https://github.com/chiubaca/gridsome-source-devto","last_synced_at":"2025-04-27T12:31:39.795Z","repository":{"id":57101666,"uuid":"326145580","full_name":"chiubaca/gridsome-source-devto","owner":"chiubaca","description":"This is a source plugin for DEV.to. It retrieves all your published articles via the DEV API (beta).","archived":false,"fork":false,"pushed_at":"2022-09-20T11:17:26.000Z","size":101,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-07T01:06:46.117Z","etag":null,"topics":["gridsome","gridsome-plugin","gridsome-source"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chiubaca.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-01-02T09:03:43.000Z","updated_at":"2023-03-07T05:32:04.000Z","dependencies_parsed_at":"2022-08-20T22:40:45.327Z","dependency_job_id":null,"html_url":"https://github.com/chiubaca/gridsome-source-devto","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/chiubaca%2Fgridsome-source-devto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiubaca%2Fgridsome-source-devto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiubaca%2Fgridsome-source-devto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chiubaca%2Fgridsome-source-devto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chiubaca","download_url":"https://codeload.github.com/chiubaca/gridsome-source-devto/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224069459,"owners_count":17250456,"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":["gridsome","gridsome-plugin","gridsome-source"],"created_at":"2024-11-11T08:09:29.817Z","updated_at":"2024-11-11T08:09:30.977Z","avatar_url":"https://github.com/chiubaca.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEV.to source plugin for Gridsome\n\n\u003e  This package is under development and API might change before v1 is released.\n\nThis is a Gridsome source plugin for [DEV.to](https://docs.dev.to/api/). It retrieves all your published articles via the [DEV API (beta)](https://docs.dev.to/api/).\n\nThis plugin merges and exposes the entire schema for both the [`getArticles`](https://docs.dev.to/api/index.html#operation/getArticles) and [`getArticleById`](https://docs.dev.to/api/index.html#operation/getArticleById) so you can benefit from both endpoints effortlessly. This is useful because for example; `page_views_count` is available on [`getArticles`](https://docs.dev.to/api/index.html#operation/getArticles) but not on [`getArticleById`](https://docs.dev.to/api/index.html#operation/getArticleById). On the flip-side `body_html` is available on [`getArticleById`](https://docs.dev.to/api/index.html#operation/getArticleById) but not on [`getArticles`](https://docs.dev.to/api/index.html#operation/getArticles). Not sure why DEV.to implemented their API like this, but with this plugin, you don't need to worry about it.\n\n## Available DEV.to attributes\n\u003cdetails\u003e\n  \u003csummary\u003eThe combined dev.to schemas provides the following attributes:\u003c/summary\u003e\n  \n  * `type_of`\n  \n  * `id`\n  \n  * `title`\n  \n  * `description`\n  \n  * `published`\n  \n  * `readable_publish_date`\n  \n  * `published_at`\n  \n  * `slug`\n  \n  * `url`\n  \n  * `comments_count`\n  \n  * `public_reactions_count`\n  \n  * `page_views_count`\n  \n  * `collection_id`\n  \n  * `published_timestamp`\n  \n  * `positive_reactions_count`\n  \n  * `social_image`\n  \n  * `canonical_url`\n  \n  * `created_at`\n  \n  * `edited_at`\n  \n  * `crossposted_at`\n  \n  * `published_at`\n  \n  * `last_comment_at`\n  \n  * `tag_list`\n  \n  * `tags`\n  \n  * `body_html`\n  \n  * `body_markdown`\n  \n  * `user`\n\u003c/details\u003e\n\n\n## Computed attributes\n\u003cdetails\u003e\n  \u003csummary\u003eIn addition, this plugin provides some handy computed attributes too: \u003c/summary\u003e\n\n  * `parsed_markdown`: Similar to `body_html`. However the parsed markdown has been processed to provide some additional extras such syntax highlighting by prism.js and github style auto links. Note: shortcodes are not parsed.\n     \n  \n  * `time_to_read`: Estimated time to read an article based on [200 word per minute](https://irisreading.com/the-average-reading-speed/).\n  \n\u003c/details\u003e\n\n## Install\n- `yarn add @chiubaca/gridsome-source-devto`\n- `npm install @chiubaca/gridsome-source-devto`\n\n## Example Usage\n\n```js\n// gridsome.config.js\nmodule.exports = {\n  plugins: [\n    {\n     use:'@chiubaca/gridsome-source-devto',\n      options : {\n        typeName: 'DevToArticles',\n        devtoAPIKey: process.env.DEVTO_KEY\n      }\n    }\n  ],\n  templates: {\n    DevToArticles: '/:title'\n  }\n}\n```\n### Options\n\n`typeName` - String (Required)\n\nThe prefix to be used for your imported schemas field types.\n\n`devtoAPIKey`- String (Required)\n\nGet your Dev.to API key by following this instructions [https://docs.dev.to/api/index.html#section/Authentication/api_key]().\nIt is best to store your key in a `.env` file rather than exposing it inline in your `gridsome.config.js` files so that your key is not exposed publicly.\n\n\n### Custom Routes\n\nTo add custom routes use the [`templates`](https://gridsome.org/docs/templates/) config with the collection type name as the key and the custom route as the value.\n\n```js\n// gridsome.config.js\nmodule.exports = {\n templates: {\n    DevToPosts: '/:title'\n  }\n}\n```\n\n### Display All Articles\nYou may want to render a list of all article titles like this\n\n```html\n\u003c!-- src/pages/Index.vue --\u003e\n\u003ctemplate\u003e\n  \u003cLayout\u003e\n    \u003ch1\u003eAll Articles\u003c/h1\u003e\n    \u003cdiv v-for=\"(post, index) in $page.posts.edges\" :key=\"index\"\u003e\n      \u003cg-link :to=\"post.node.path\"\u003e{{ post.node.title }}\u003c/g-link\u003e\n    \u003c/div\u003e\n  \u003c/Layout\u003e\n\u003c/template\u003e\n\n\u003cpage-query\u003e\n  query{\n    posts: allDevToArticles{\n      edges {\n        node{\n          title\n          path\n        }\n      }\n    }\n  }\n\u003c/page-query\u003e\n\n```\n\n### Display A Single Article\nYou can render the each individual article in the `DevToArticles.vue` file.\n\n```html\n\u003c!-- src/templates/DevToArticles.vue --\u003e\n\u003ctemplate\u003e\n  \u003cLayout\u003e\n    \u003carticle v-html=\"$page.posts.parsed_markdown\" \u003e\u003c/article\u003e\n  \u003c/Layout\u003e\n\u003c/template\u003e\n\n\u003cpage-query\u003e\n  query DevToArticles ($path: String!) {\n    posts: devToArticles (path: $path) {\n      title\n      parsed_markdown\n    }\n  }\n\u003c/page-query\u003e\n\n\u003cscript\u003e\nimport '@/prism_themes/prism-tomorrow.css';\nexport default {\n  metaInfo() {\n    return {\n      title: this.$page.blogs.title\n    };\n  }\n};\n\u003c/script\u003e\n\n```\n\u003e To stylise your code blocks. You can download different stylesheets compatible with prism.js [here](https://prismjs.com/index.html).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiubaca%2Fgridsome-source-devto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchiubaca%2Fgridsome-source-devto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchiubaca%2Fgridsome-source-devto/lists"}