From 9d6b8cadcc6cd59bde6b9b20037f9038190672ce Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Thu, 26 Nov 2020 13:57:12 +0100 Subject: [PATCH] feat: add native support for carbon ads (#86) Co-authored-by: Kia King Ishii --- docs/.vitepress/config.js | 11 +- docs/config/carbon-ads.md | 13 ++ src/client/theme-default/Layout.vue | 18 +++ .../theme-default/components/BuySellAds.vue | 146 ++++++++++++++++++ .../theme-default/components/CarbonAds.vue | 102 ++++++++++++ .../theme-default/styles/custom-blocks.css | 1 + src/client/theme-default/styles/vars.css | 2 + 7 files changed, 292 insertions(+), 1 deletion(-) create mode 100644 docs/config/carbon-ads.md create mode 100644 src/client/theme-default/components/BuySellAds.vue create mode 100644 src/client/theme-default/components/CarbonAds.vue diff --git a/docs/.vitepress/config.js b/docs/.vitepress/config.js index ca10e3c7..6a7dc24e 100644 --- a/docs/.vitepress/config.js +++ b/docs/.vitepress/config.js @@ -11,6 +11,12 @@ module.exports = { editLinkText: 'Edit this page on GitHub', lastUpdated: 'Last Updated', + carbonAds: { + carbon: 'CEBDT27Y', + custom: 'CKYD62QM', + placement: 'vuejsorg' + }, + nav: [ { text: 'Guide', link: '/' }, { text: 'Config Reference', link: '/config/basics' }, @@ -55,7 +61,10 @@ function getConfigSidebar() { return [ { text: 'App Config', - children: [{ text: 'Basics', link: '/config/basics' }] + children: [ + { text: 'Basics', link: '/config/basics' }, + { text: 'Carbon Ads', link: '/config/carbon-ads' } + ] } ] } diff --git a/docs/config/carbon-ads.md b/docs/config/carbon-ads.md new file mode 100644 index 00000000..20abee95 --- /dev/null +++ b/docs/config/carbon-ads.md @@ -0,0 +1,13 @@ +# Carbon Ads + +VitePress has built in native support for [Carbon Ads](https://www.carbonads.net). By defining the Carbon Ads credentials in config, VitePress will display ads on the page. + +```js +module.exports = { + carbonAds: { + carbon: 'your-carbon-key', + custom: 'your-carbon-custom', + placement: 'your-carbon-placement' + } +} +``` diff --git a/src/client/theme-default/Layout.vue b/src/client/theme-default/Layout.vue index 6b3f9443..a95cc45a 100644 --- a/src/client/theme-default/Layout.vue +++ b/src/client/theme-default/Layout.vue @@ -34,10 +34,26 @@
@@ -53,6 +69,8 @@ import ToggleSideBarButton from './components/ToggleSideBarButton.vue' import SideBar from './components/SideBar.vue' import Page from './components/Page.vue' import { useRoute, useSiteData, useSiteDataByRoute } from 'vitepress' +import CarbonAds from './components/CarbonAds.vue' +import BuySellAds from './components/BuySellAds.vue' const route = useRoute() const siteData = useSiteData() diff --git a/src/client/theme-default/components/BuySellAds.vue b/src/client/theme-default/components/BuySellAds.vue new file mode 100644 index 00000000..2ddccf3b --- /dev/null +++ b/src/client/theme-default/components/BuySellAds.vue @@ -0,0 +1,146 @@ + + + + + diff --git a/src/client/theme-default/components/CarbonAds.vue b/src/client/theme-default/components/CarbonAds.vue new file mode 100644 index 00000000..7f3e6d6a --- /dev/null +++ b/src/client/theme-default/components/CarbonAds.vue @@ -0,0 +1,102 @@ + + + + + diff --git a/src/client/theme-default/styles/custom-blocks.css b/src/client/theme-default/styles/custom-blocks.css index b96580df..b5456d76 100644 --- a/src/client/theme-default/styles/custom-blocks.css +++ b/src/client/theme-default/styles/custom-blocks.css @@ -4,6 +4,7 @@ margin: 1rem 0; border-left: .5rem solid; padding: .1rem 1.5rem; + overflow-x: auto; } .custom-block.tip { diff --git a/src/client/theme-default/styles/vars.css b/src/client/theme-default/styles/vars.css index 4ae10251..4957c052 100644 --- a/src/client/theme-default/styles/vars.css +++ b/src/client/theme-default/styles/vars.css @@ -13,6 +13,7 @@ --c-text-light-1: #2c3e50; --c-text-light-2: #476582; + --c-text-light-3: #90a4b7; --c-brand: #3eaf7c; --c-brand-light: #4abf8a; @@ -45,6 +46,7 @@ --c-text: var(--c-text-light-1); --c-text-light: var(--c-text-light-2); + --c-text-lighter: var(--c-text-light-3); --c-bg: var(--c-white);