Skip to content

Commit 37c1aa6

Browse files
committed
Merge branch 'master' into littledata-docs-update
2 parents a9908e4 + 9e39852 commit 37c1aa6

File tree

192 files changed

+22481
-6273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+22481
-6273
lines changed

.buildkite/pipeline.yml

Lines changed: 0 additions & 51 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ src/assets/docs.bundle.js
1212
yarn-error.log
1313
# Make sure to update `analytics` to the full path to your Typewriter client.
1414
.vscode/spellright.dict
15+
16+
# Local Netlify folder
17+
.netlify

CODEOWNERS

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
# The default owners for everything in
22
# the repo. Unless a later match takes precedence.
3-
CODEOWNERS @segmentio/segment-doc-team
3+
CODEOWNERS @segmentio/segment-doc-team @sanscontext @markzegarelli
44

55
# Diagram library
6-
/diagram-library @sanscontext
6+
/diagram-library @sanscontext @markzegarelli
77

88
# Utility scripts
9-
/scripts @segmentio/segment-doc-team @XavierAgostini
9+
/scripts @segmentio/segment-doc-team
1010

1111
# Vale Linting
1212
/vale-styles @segmentio/segment-doc-team
1313
.vale.ini @segmentio/segment-doc-team
1414

15+
1516
# Content owners should be in the order of PM, TL (team-lead), and EM (in a crisis) for a given team.
1617
# This team will receive review requests automatically when a PR is submitted modifying the files in
1718
# a given directory+subtree, or file type, etc. that matches below. While Github won't enforce the
@@ -23,16 +24,16 @@ CODEOWNERS @segmentio/segment-doc-team
2324
# Libraries owners
2425
/src/connections/catalog/libraries @osamakhn @bsneed @pooyaj @juliofarah
2526

26-
# Destination owners
27+
# Destinations owners
2728
/src/connections/destinations @segmentio/segment-doc-team
2829

2930

30-
# Privacy owners
31-
/src/privacy @notfelineit
31+
# Privacy owners TODO
32+
# /src/privacy
3233

3334

34-
# Protocols owners
35-
/src/protocols @francisco @rarchana2001asu
35+
# Protocols owners TODO
36+
# /src/protocols
3637

3738
# Partner Program owners
3839
/src/partners @misteryeo @n2parko @benhorowitz

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ group :jekyll_plugins do
1717
gem 'jekyll-redirect-from'
1818
gem "premonition", "~> 2.0.0"
1919
gem "jekyll-include-cache"
20+
gem 'jekyll-algolia'
21+
gem 'jekyll-dotenv'
2022
end
2123

2224
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem

Gemfile.lock

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ GEM
2323
specs:
2424
addressable (2.7.0)
2525
public_suffix (>= 2.0.2, < 5.0)
26+
algolia_html_extractor (2.6.4)
27+
json (~> 2.0)
28+
nokogiri (~> 1.10)
29+
algoliasearch (1.27.5)
30+
httpclient (~> 2.8, >= 2.8.3)
31+
json (>= 1.5.1)
2632
colorator (1.1.0)
2733
commonmarker (0.21.0)
2834
ruby-enum (~> 0.5)
@@ -36,13 +42,27 @@ GEM
3642
multipart-post (>= 1.2, < 3)
3743
ruby2_keywords
3844
ffi (1.13.1)
45+
filesize (0.2.0)
3946
forwardable-extended (2.6.0)
4047
http_parser.rb (0.6.0)
48+
httpclient (2.8.3)
4149
i18n (1.8.5)
4250
concurrent-ruby (~> 1.0)
51+
jekyll-algolia (1.6.0)
52+
algolia_html_extractor (~> 2.6)
53+
algoliasearch (~> 1.26)
54+
filesize (~> 0.1)
55+
jekyll (>= 3.6, < 5.0)
56+
json (~> 2.0)
57+
nokogiri (~> 1.6)
58+
progressbar (~> 1.9)
59+
verbal_expressions (~> 0.1.5)
4360
jekyll-commonmark (1.3.1)
4461
commonmarker (~> 0.14)
4562
jekyll (>= 3.7, < 5.0)
63+
jekyll-dotenv (0.2.0)
64+
dotenv (~> 2.7)
65+
jekyll (~> 4)
4666
jekyll-include-cache (0.2.1)
4767
jekyll (>= 3.7, < 5.0)
4868
jekyll-last-modified-at (1.3.0)
@@ -56,7 +76,8 @@ GEM
5676
jekyll (>= 3.7, < 5.0)
5777
jekyll-watch (2.2.1)
5878
listen (~> 3.0)
59-
kramdown (2.3.0)
79+
json (2.5.1)
80+
kramdown (2.3.1)
6081
rexml
6182
kramdown-parser-gfm (1.1.0)
6283
kramdown (~> 2.0)
@@ -67,12 +88,22 @@ GEM
6788
rb-fsevent (~> 0.10, >= 0.10.3)
6889
rb-inotify (~> 0.9, >= 0.9.10)
6990
mercenary (0.4.0)
91+
mini_portile2 (2.5.0)
7092
multipart-post (2.1.1)
93+
nokogiri (1.11.1)
94+
mini_portile2 (~> 2.5.0)
95+
racc (~> 1.4)
96+
nokogiri (1.11.1-x86_64-darwin)
97+
racc (~> 1.4)
98+
nokogiri (1.11.1-x86_64-linux)
99+
racc (~> 1.4)
71100
pathutil (0.16.2)
72101
forwardable-extended (~> 2.6)
73102
posix-spawn (0.3.15)
74103
premonition (2.0.1)
104+
progressbar (1.11.0)
75105
public_suffix (4.0.6)
106+
racc (1.5.2)
76107
rake (13.0.1)
77108
rb-fsevent (0.10.4)
78109
rb-inotify (0.10.1)
@@ -93,17 +124,21 @@ GEM
93124
tzinfo-data (1.2020.4)
94125
tzinfo (>= 1.0.0)
95126
unicode-display_width (1.7.0)
127+
verbal_expressions (0.1.5)
96128
wdm (0.1.1)
97129

98130
PLATFORMS
99131
ruby
100-
x86_64-linux-musl
132+
x86_64-darwin-20
133+
x86_64-linux
101134

102135
DEPENDENCIES
103136
dotenv
104137
faraday
105138
jekyll!
139+
jekyll-algolia
106140
jekyll-commonmark
141+
jekyll-dotenv
107142
jekyll-include-cache
108143
jekyll-last-modified-at
109144
jekyll-redirect-from

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,9 @@ Each piece of frontmatter does something special!
189189
#### Content-related frontmatter
190190
- `beta`: default false. When true, show an "in beta" warning in the page layout (see the warning in `_includes/content/beta-note.md`)
191191
- `rewrite`: defaults to false. This is a legacy frontmatter flag that comes from the old `site-docs` repo, and which labels any destination that was rewritten in ~2018 to a standardized template. It disables the duplicate "connection modes" table that would otherwise show up in the boilerplate content at the end of the page.
192-
- `hide-boilerplate`: defaults to false. When true, none of the content from `integration-foot.md` is appended to the destination page.
192+
- `hide-boilerplate`: defaults to false. When true, none of the content from `destination-footer.md` is appended to the destination page.
193193
- `hide-cmodes`: defaults to false. A renaming of "rewrite" for more clarity, hides the connection modes table in the boilerplate.
194-
- `hide-personas-partial`: defaults to false. When true, hides the section of content from `integration-foot.md` that talks about being able to receive personas data.
194+
- `hide-personas-partial`: defaults to false. When true, hides the section of content from `destination-footer.md` that talks about being able to receive personas data.
195195
- `integration_type`: This is set in the `_config.yml` on three paths to add a noun (Source, Destination, or Warehouse) to the end of the title, and the end of the title tag in the html layout. It also controls the layout and icon for some of these.
196196
- `source-type`: These are only used to supplement when a Cloud App in the sources path doesn't appear in the Config API list, and needs its type explicitly set. It runs some logic in the `cloud-app-note.md` to explain which cloud-apps are object vs event sources.
197197

_config.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ defaults:
2525
path: "connections/destinations/catalog"
2626
values:
2727
integration_type: destination
28-
layout: integration
28+
layout: destination
2929
- scope:
3030
path: "connections/sources/catalog"
3131
values:
3232
integration_type: source
33-
layout: integration
33+
layout: source
3434
- scope:
3535
path: "connections/storage/catalog"
3636
values:
@@ -49,3 +49,9 @@ plugins:
4949
- premonition
5050
- jekyll-commonmark
5151
- jekyll-last-modified-at
52+
- jekyll-dotenv
53+
algolia:
54+
application_id: UINQ2M4D9S
55+
index_name: segment-docs
56+
files_to_exclude:
57+
- _release_notes/*

devguide.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,45 @@ The script also “calculates” the values for the `connection-modes` table for
4747

4848
It also does some slugification and destination-name normalization, since our handling of dots and dashes hasn't been consistent over time. Finally, it checks to see if there’s a folder for each destination. If it finds a new one, the script makes a folder with a “stub” markdown file for that destination, and then adds a line for it to an "incompleteDocs.txt" file. (It doesn't check to see if it's already listed, just appends to the file.)
4949

50+
### Connection Modes in the Catalog script
51+
52+
As part of the Dossiers project we worked on making the Connection Modes table more readable. Originally we were going to have per-page liquid run, but these modes don't change often so it would've added a lot of build time for very little benefit. Instead we pushed it into `catalog.js`.
53+
Once the connection modes device and cloud arrays are set, we do a bunch of calculations, and add a text summary, a number which corresponds to that summary for easier programmatic writing, and a rough category.
54+
55+
| Case | Summary | Type | Message |
56+
| ---- | -------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
57+
| 0 | No data available | none | No connection mode information available. |
58+
| 1 | Both device, no cloud | device-only | accepts device-mode data from both Analytics.js and mobile sources. It does not accept data in cloud-mode. |
59+
| 2 | AJS (web device) only | device-only | accepts device-mode data only from Analytics.js. |
60+
| 3 | Mobile device mode only | device-only | accepts device-mode data only from a mobile source. |
61+
| 4 | Accepts from all | all | accepts cloud-mode data from all Segment source types. It can accept device-mode data from both web and mobile sources. |
62+
| 5 | All cloud types | cloud-only | accepts cloud-mode data from all Segment source types. It does not offer device-mode connections. |
63+
| 6 | Mobile and Server cloud only | cloud-only | accepts data from any Segment mobile or server source in cloud mode. It does not accept data from a web source, and does not offer device-mode connections. |
64+
| 7 | Web and mobile cloud only | cloud-only | accepts only cloud-mode data from web and mobile sources. |
65+
| 8 | Mobile cloud only | cloud-only | accepts only cloud-mode data from mobile sources. |
66+
| 9 | All cloud types, 1 device mode | mixed | accepts data in cloud-mode from all source types, and can accept data in device-mode from [Analytics.js or mobile] sources. |
67+
| 10 | Web and mobile cloud, 1 device | mixed | accepts data in cloud-mode from web and mobile sources, and can accept data in device-mode from [Analytics.js or mobile] sources. |
68+
| 11 | Mobile and server cloud, mobile device | mixed | accepts data in cloud-mode from mobile and server sources, and can accept data in device-mode from mobile sources. |
5069

5170
## Developer information
5271

5372

5473
### Layouts
5574

56-
`default.html` is the base container through which all the individual other layouts (currently one, `page.html`) are built to have the right title, seo, etc. `Integration.html` contains the logic that runs the catalog pages.
75+
`default.html` is the base container through which all the individual other layouts are built to have the right title, seo, etc. The template inheritance is described in the diagram below.
76+
77+
The `destination.html`, `source.html`, and `integration.html` templates contain the logic that runs the layouts for individual catalog pages. Storage/warehouses use the generic Integration right now because they don't need anything special. Set the layout in the Jekyll `_config.yml` file.
5778

5879
```text
5980
default.html
60-
|- integration.html
61-
|- catalog.html
62-
|- main.html
63-
|-page.html
64-
|-home.html
81+
|- integration.html
82+
|- destination.html
83+
|- source.html
84+
|- main.html
85+
|- catalog.html - used for connections catalog pages only
86+
|- home.html - for main landing page only
87+
|- page.html - used for all pages outside Connections catalogs, without an explicit override
88+
|- search.html - search results page only
6589
```
6690

6791
### Platform Config API + Catalog

js/algolia/index.js

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import { html } from 'htm/preact';
2+
import algoliasearch from 'algoliasearch/lite';
3+
import { autocomplete, getAlgoliaHits, highlightHit } from '@algolia/autocomplete-js';
4+
import {createAlgoliaInsightsPlugin} from '@algolia/autocomplete-plugin-algolia-insights';
5+
import insightsClient from 'search-insights';
6+
7+
8+
const appId = 'UINQ2M4D9S';
9+
const apiKey = '636b6d9e2dfb207e89ea7344859848f9';
10+
const searchClient = algoliasearch(appId, apiKey);
11+
12+
//insights
13+
insightsClient('init', { appId, apiKey });
14+
const algoliaInsightsPlugin = createAlgoliaInsightsPlugin({ insightsClient });
15+
16+
// define locations to separate invocation for mobile and desktop
17+
const locations = ['#autocomplete','#autocomplete-mobile'];
18+
19+
function initAutocomplete(item){
20+
const search = autocomplete({
21+
container: item,
22+
placeholder: 'Search the Segment documentation',
23+
debug: false,
24+
openOnFocus: false,
25+
keyboardShortcuts: ['s', 191],
26+
plugins: [algoliaInsightsPlugin,],
27+
detachedMediaQuery:'none',
28+
getSources( {query} ) {
29+
return [
30+
{
31+
sourceId: 'articles',
32+
getItemUrl({ item }){
33+
if (item.anchor != null) {
34+
var itemUrl = item.url+"#" + item.anchor;
35+
} else {
36+
var itemUrl = item.url;
37+
}
38+
return itemUrl;
39+
},
40+
getItems() {
41+
return getAlgoliaHits({
42+
searchClient,
43+
queries: [
44+
{
45+
indexName: 'segment-docs',
46+
query,
47+
params: {
48+
hitsPerPage: 7,
49+
facetFilters: ['hidden:-true'],
50+
clickAnalytics: true,
51+
},
52+
},
53+
],
54+
});
55+
},
56+
templates: {
57+
item({ item }){
58+
if (item.anchor != null) {
59+
var anchorLink = "#" + item.anchor;
60+
} else {
61+
var anchorLink = "";
62+
}
63+
return html `<a class="aa-link" href="/docs${item.url}${anchorLink}">
64+
<p class="aa-title" >${highlightHit({hit: item, attribute: 'title'})}</h3>
65+
<p class="aa-heading">${item.headings.join(' >')}</p>
66+
<p class="aa-content">${highlightHit({hit: item, attribute: 'content'})}</p></a>
67+
`;
68+
},
69+
noResults() {
70+
return html `<p class="aa-content">No results for <strong>${query}</strong></p>`;
71+
}
72+
},
73+
74+
},
75+
];
76+
},
77+
navigator: {
78+
navigate({ itemUrl }) {
79+
window.location.assign('/docs'+itemUrl);
80+
},
81+
}
82+
});
83+
84+
}
85+
86+
locations.forEach(initAutocomplete);

0 commit comments

Comments
 (0)