diff --git a/docs/en/programming.md b/docs/en/programming.md index 1d7c0e3a49a01c..61802ea98e896b 100644 --- a/docs/en/programming.md +++ b/docs/en/programming.md @@ -4,6 +4,70 @@ pageClass: routes # Programming +## A List Apart + +### Articles + + + +### Topics + + + +You have the option to utilize the main heading or use individual categories as topics for the path. + +::: details Topics + +| **Code** | _code_ | +|-------------------------|-------------------------| +| **Application Development** | _application-development_ | +| **Browsers** | _browsers_ | +| **CSS** | _css_ | +| **HTML** | _html_ | +| **JavaScript** | _javascript_ | +| **The Server Side** | _the-server-side_ | + +| **Content** | _content_ | +|-------------------------|-------------------------| +| **Community** | _community_ | +| **Content Strategy** | _content-strategy_ | +| **Writing** | _writing_ | + +| **Design** | _design_ | +|-------------------------|-------------------------| +| **Brand Identity** | _brand-identity_ | +| **Graphic Design** | _graphic-design_ | +| **Layout & Grids** | _layout-grids_ | +| **Mobile/Multidevice** | _mobile-multidevice_ | +| **Responsive Design** | _responsive-design_ | +| **Typography & Web Fonts** | _typography-web-fonts_ | + +| **Industry & Business** | _industry-business_ | +|-------------------------|-------------------------| +| **Business** | _business_ | +| **Career** | _career_ | +| **Industry** | _industry_ | +| **State of the Web** | _state-of-the-web_ | + +| **Process** | _process_ | +|-------------------------|-------------------------| +| **Creativity** | _creativity_ | +| **Project Management** | _project-management_ | +| **Web Strategy** | _web-strategy_ | +| **Workflow & Tools** | _workflow-tools_ | + +| **User Experience** | _user-experience_ | +|-------------------------|-------------------------| +| **Accessibility** | _accessibility_ | +| **Information Architecture** | _information-architecture_ | +| **Interaction Design** | _interaction-design_ | +| **Usability** | _usability_ | +| **User Research** | _user-research_ | + +::: + + + ## ACM ### A.M.Turing Award Winners diff --git a/lib/v2/alistapart/index.js b/lib/v2/alistapart/index.js new file mode 100644 index 00000000000000..8be8b9eeade989 --- /dev/null +++ b/lib/v2/alistapart/index.js @@ -0,0 +1,19 @@ +const { getData, getList } = require('./utils'); + +module.exports = async (ctx) => { + const baseUrl = 'https://alistapart.com'; + const route = '/wp-json/wp/v2/article?_embed'; + + const data = await getData(`${baseUrl}${route}`); + const items = await getList(data); + + ctx.state.data = { + title: 'A List Apart', + link: `${baseUrl}/articles`, + item: items, + description: 'Articles on aListApart.com', + logo: 'https://i0.wp.com/alistapart.com/wp-content/uploads/2019/03/cropped-icon_navigation-laurel-512.jpg?fit=192,192&ssl=1', + icon: 'https://i0.wp.com/alistapart.com/wp-content/uploads/2019/03/cropped-icon_navigation-laurel-512.jpg?fit=32,32&ssl=1', + language: 'en-us', + }; +}; diff --git a/lib/v2/alistapart/maintainer.js b/lib/v2/alistapart/maintainer.js new file mode 100644 index 00000000000000..508e3485a5a094 --- /dev/null +++ b/lib/v2/alistapart/maintainer.js @@ -0,0 +1,4 @@ +module.exports = { + '/': ['Rjnishant530'], + '/:topic': ['Rjnishant530'], +}; diff --git a/lib/v2/alistapart/radar.js b/lib/v2/alistapart/radar.js new file mode 100644 index 00000000000000..911dadcd62bf30 --- /dev/null +++ b/lib/v2/alistapart/radar.js @@ -0,0 +1,19 @@ +module.exports = { + 'alistapart.com': { + _name: 'A List Apart', + '.': [ + { + title: 'Articles', + docs: 'https://docs.rsshub.app/en/programming.html#a-list-apart', + source: ['/articles/'], + target: '/alistapart', + }, + { + title: 'Topics', + docs: 'https://docs.rsshub.app/en/programming.html#a-list-apart', + source: ['/blog/topic/:topic'], + target: '/alistapart/:topic', + }, + ], + }, +}; diff --git a/lib/v2/alistapart/router.js b/lib/v2/alistapart/router.js new file mode 100644 index 00000000000000..c995b150d280a6 --- /dev/null +++ b/lib/v2/alistapart/router.js @@ -0,0 +1,4 @@ +module.exports = (router) => { + router.get('/', require('./index')); + router.get('/:topic', require('./topic')); +}; diff --git a/lib/v2/alistapart/topic.js b/lib/v2/alistapart/topic.js new file mode 100644 index 00000000000000..d9db2097ce62b6 --- /dev/null +++ b/lib/v2/alistapart/topic.js @@ -0,0 +1,21 @@ +const { getData, getList } = require('./utils'); + +module.exports = async (ctx) => { + const baseUrl = 'https://alistapart.com'; + const searchRoute = '/wp-json/wp/v2/categories?slug='; + const articleRoute = '/wp-json/wp/v2/article?categories='; + const { topic } = ctx.params; + const id = (await getData(`${baseUrl}${searchRoute}${topic}`))[0]?.id; + const data = await getData(`${baseUrl}${articleRoute}${id}&_embed`); + const items = await getList(data); + + ctx.state.data = { + title: 'A List Apart', + link: `${baseUrl}/blog/topic/${topic}`, + item: items, + description: `${topic[0].toUpperCase() + topic.slice(1)} Articles on aListApart.com`, + logo: 'https://i0.wp.com/alistapart.com/wp-content/uploads/2019/03/cropped-icon_navigation-laurel-512.jpg?fit=192,192&ssl=1', + icon: 'https://i0.wp.com/alistapart.com/wp-content/uploads/2019/03/cropped-icon_navigation-laurel-512.jpg?fit=32,32&ssl=1', + language: 'en-us', + }; +}; diff --git a/lib/v2/alistapart/utils.js b/lib/v2/alistapart/utils.js new file mode 100644 index 00000000000000..5f68f3d687b82b --- /dev/null +++ b/lib/v2/alistapart/utils.js @@ -0,0 +1,22 @@ +const got = require('@/utils/got'); +const { parseDate } = require('@/utils/parse-date'); +const timezone = require('@/utils/timezone'); + +const getData = (url) => got.get(url).json(); + +const getList = (data) => + data.map((value) => { + const { id, title, content, date_gmt, modified_gmt, link, _embedded } = value; + return { + id, + title: title.rendered, + description: content.rendered, + link, + category: _embedded['wp:term'][0].map((v) => v.name), + author: _embedded.author.map((v) => v.name).join(', '), + pubDate: timezone(parseDate(date_gmt), 0), + updated: timezone(parseDate(modified_gmt), 0), + }; + }); + +module.exports = { getData, getList };