From 1f378581f876924a0182547d1dfbdd0e8d20b956 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis <axilleas@axilleas.me> Date: Sat, 14 Dec 2019 10:13:51 +0100 Subject: [PATCH] Update pages and README.md - Adapt this to work under page/docusaurus - Add content to website pointing back to https://gitlab.com/pages/docusaurus - Add info in README.md - Change mod for files that were 755 --- .dockerignore | 0 .gitignore | 0 .gitlab-ci.yml | 7 +- Dockerfile | 0 README.md | 104 +++++++++++- docker-compose.yml | 0 docs/doc1.md | 0 docs/doc2.md | 0 docs/doc3.md | 0 docs/exampledoc4.md | 0 docs/exampledoc5.md | 0 website/README.md | 155 +++++++++--------- website/blog/2016-03-11-blog-post.md | 0 website/blog/2017-04-10-blog-post-two.md | 0 website/blog/2017-09-25-testing-rss.md | 0 website/blog/2017-09-26-adding-rss.md | 0 website/blog/2017-10-24-new-version-1.0.0.md | 0 website/core/Footer.js | 3 +- website/pages/en/help.js | 0 website/pages/en/index.js | 2 +- website/pages/en/users.js | 0 website/sidebars.json | 0 website/siteConfig.js | 18 +- website/static/css/custom.css | 0 website/static/img/favicon.ico | Bin website/static/img/oss_logo.png | Bin website/static/img/undraw_code_review.svg | 0 website/static/img/undraw_monitor.svg | 0 website/static/img/undraw_note_list.svg | 0 website/static/img/undraw_online.svg | 0 website/static/img/undraw_open_source.svg | 0 .../static/img/undraw_operating_system.svg | 0 website/static/img/undraw_react.svg | 0 website/static/img/undraw_tweetstorm.svg | 0 .../static/img/undraw_youtube_tutorial.svg | 0 35 files changed, 195 insertions(+), 94 deletions(-) mode change 100755 => 100644 .dockerignore mode change 100755 => 100644 .gitignore mode change 100755 => 100644 Dockerfile mode change 100755 => 100644 docker-compose.yml mode change 100755 => 100644 docs/doc1.md mode change 100755 => 100644 docs/doc2.md mode change 100755 => 100644 docs/doc3.md mode change 100755 => 100644 docs/exampledoc4.md mode change 100755 => 100644 docs/exampledoc5.md mode change 100755 => 100644 website/README.md mode change 100755 => 100644 website/blog/2016-03-11-blog-post.md mode change 100755 => 100644 website/blog/2017-04-10-blog-post-two.md mode change 100755 => 100644 website/blog/2017-09-25-testing-rss.md mode change 100755 => 100644 website/blog/2017-09-26-adding-rss.md mode change 100755 => 100644 website/blog/2017-10-24-new-version-1.0.0.md mode change 100755 => 100644 website/core/Footer.js mode change 100755 => 100644 website/pages/en/help.js mode change 100755 => 100644 website/pages/en/index.js mode change 100755 => 100644 website/pages/en/users.js mode change 100755 => 100644 website/sidebars.json mode change 100755 => 100644 website/static/css/custom.css mode change 100755 => 100644 website/static/img/favicon.ico mode change 100755 => 100644 website/static/img/oss_logo.png mode change 100755 => 100644 website/static/img/undraw_code_review.svg mode change 100755 => 100644 website/static/img/undraw_monitor.svg mode change 100755 => 100644 website/static/img/undraw_note_list.svg mode change 100755 => 100644 website/static/img/undraw_online.svg mode change 100755 => 100644 website/static/img/undraw_open_source.svg mode change 100755 => 100644 website/static/img/undraw_operating_system.svg mode change 100755 => 100644 website/static/img/undraw_react.svg mode change 100755 => 100644 website/static/img/undraw_tweetstorm.svg mode change 100755 => 100644 website/static/img/undraw_youtube_tutorial.svg diff --git a/.dockerignore b/.dockerignore old mode 100755 new mode 100644 diff --git a/.gitignore b/.gitignore old mode 100755 new mode 100644 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8aef119..370d4eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,11 +5,14 @@ pages: - cd website - yarn install - yarn build - - mv ./build/test-site ../public + # The build directory is created based on the value set for projectName in + # website/siteConfig.js. If you change it there, you need to change it here + # as well. + - mv ./build/docusaurus ../public artifacts: paths: - public - + only: - master diff --git a/Dockerfile b/Dockerfile old mode 100755 new mode 100644 diff --git a/README.md b/README.md index 7dd802a..d59a08d 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,104 @@ -# docs + +--- + +Example [Docusaurus] website using GitLab Pages. + +Learn more about GitLab Pages at https://about.gitlab.com/features/pages and the official +documentation https://docs.gitlab.com/ee/user/project/pages/. + +--- + +## GitLab CI/CD + +This project's static Pages are built by [GitLab CI/CD](https://about.gitlab.com/product/continuous-integration/), +following the steps defined in [`.gitlab-ci.yml`](.gitlab-ci.yml): + +```yaml +image: node:9.11.1 + +pages: + script: + - cd website + - yarn install + - yarn build + # The build directory is created based on the value set for projectName in + # website/siteConfig.js. If you change it there, you need to change it here + # as well. + - mv ./build/docusaurus ../public + artifacts: + paths: + - public + only: + - master +``` + +## Building locally + +To work locally with this project, you'll have to follow the steps below: + +1. Fork, clone or download this project. +1. Install Docusaurus: + + ```sh + cd website + yarn install + ``` + +1. Preview your project: + + ```sh + yarn start + ``` + + Your site can be accessed under http://localhost:3000. + +1. Add content. +1. Generate the website (optional): + + ```sh + yarn build + ``` + + The build directory is created based on the value set for `projectName` in + `website/siteConfig.js`. If you didn't change this value, the website will + be built under `website/build/docusaurus/`. + +Read more at the [Docusaurus documentation](https://docusaurus.io). + +## GitLab User or Group Pages + +If you have forked this project, in order to use it as your user/group website +served on the root path, you will need to: + +1. Change the path of your project to `namespace.gitlab.io`, where `namespace` is + your `username` or `groupname`. This can be done by navigating to your + project's **Settings > General** page under the Advanced section. +1. Open `website/siteConfig.js` and change: + 1. The `url` to be `https://namespace.gitlab.io` or your + [custom domain](https://docs.gitlab.com/ee/user/project/pages/custom_domains_ssl_tls_certification/index.html) of choice. + 1. The `baseUrl` to be an empty string. + +If you have forked this project, and want to use it under a subpath, you will +need to: + +1. Open `website/siteConfig.js` and change: + 1. The `url` to be `https://namespace.gitlab.io` or your + [custom domain](https://docs.gitlab.com/ee/user/project/pages/custom_domains_ssl_tls_certification/index.html) of choice. + 1. The `baseUrl` to be the same as the name of your project. + +Read more about the [types of GitLab Pages](https://docs.gitlab.com/ce/user/project/pages/getting_started_part_one.html). + +## Did you fork this project? + +If you forked this project for your own use, please go to your project's +**Settings > General > Advanced** and remove the forking relationship, which +won't be necessary unless you want to contribute back to the GitLab upstream project. + +## Troubleshooting + +1. CSS is missing! That means two things: + + Either that you have wrongly set up the CSS URL in your templates, or + your static generator has a configuration option that needs to be explicitly + set in order to serve static assets under a relative URL. diff --git a/docker-compose.yml b/docker-compose.yml old mode 100755 new mode 100644 diff --git a/docs/doc1.md b/docs/doc1.md old mode 100755 new mode 100644 diff --git a/docs/doc2.md b/docs/doc2.md old mode 100755 new mode 100644 diff --git a/docs/doc3.md b/docs/doc3.md old mode 100755 new mode 100644 diff --git a/docs/exampledoc4.md b/docs/exampledoc4.md old mode 100755 new mode 100644 diff --git a/docs/exampledoc5.md b/docs/exampledoc5.md old mode 100755 new mode 100644 diff --git a/website/README.md b/website/README.md old mode 100755 new mode 100644 index 7391779..73ab1de --- a/website/README.md +++ b/website/README.md @@ -8,19 +8,17 @@ This website was created with [Docusaurus](https://docusaurus.io/). * [Adding Content](#adding-content) * [Full Documentation](#full-documentation) -# Get Started in 5 Minutes +## Get Started in 5 Minutes 1. Make sure all the dependencies for the website are installed: ```sh -# Install dependencies -$ yarn +yarn ``` 2. Run your dev server: ```sh -# Start the site -$ yarn start +yarn start ``` ## Directory Structure @@ -65,7 +63,7 @@ title: This Doc Needs To Be Edited Edit me... ``` -For more information about docs, click [here](https://docusaurus.io/docs/en/navigation) +More information about [docs](https://docusaurus.io/docs/en/navigation). ## Editing an existing blog post @@ -81,7 +79,7 @@ title: This Blog Post Needs To Be Edited Edit me... ``` -For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog) +More information about [blog posts](https://docusaurus.io/docs/en/adding-blog). # Adding Content @@ -89,105 +87,102 @@ For more information about blog posts, click [here](https://docusaurus.io/docs/e 1. Create the doc as a new markdown file in `/docs`, example `docs/newly-created-doc.md`: -```md ---- -id: newly-created-doc -title: This Doc Needs To Be Edited ---- + ```md + --- + id: newly-created-doc + title: This Doc Needs To Be Edited + --- -My new content here.. -``` + My new content here.. + ``` 1. Refer to that doc's ID in an existing sidebar in `website/sidebar.json`: -```javascript -// Add newly-created-doc to the Getting Started category of docs -{ - "docs": { - "Getting Started": [ - "quick-start", - "newly-created-doc" // new doc here - ], - ... - }, - ... -} -``` - -For more information about adding new docs, click [here](https://docusaurus.io/docs/en/navigation) + ```javascript + // Add newly-created-doc to the Getting Started category of docs + { + "docs": { + "Getting Started": [ + "quick-start", + "newly-created-doc" // new doc here + ], + ... + }, + ... + } + ``` + +More information about [adding new docs](https://docusaurus.io/docs/en/navigation). ## Adding a new blog post 1. Make sure there is a header link to your blog in `website/siteConfig.js`: -`website/siteConfig.js` -```javascript -headerLinks: [ - ... - { blog: true, label: 'Blog' }, - ... -] -``` + ```javascript + headerLinks: [ + ... + { blog: true, label: 'Blog' }, + ... + ] + ``` -2. Create the blog post with the format `YYYY-MM-DD-My-Blog-Post-Title.md` in `website/blog`: +1. Create the blog post with the format `YYYY-MM-DD-My-Blog-Post-Title.md` in `website/blog`: -`website/blog/2018-05-21-New-Blog-Post.md` + `website/blog/2018-05-21-New-Blog-Post.md` -```markdown ---- -author: Frank Li -authorURL: https://twitter.com/foobarbaz -authorFBID: 503283835 -title: New Blog Post ---- + ```markdown + --- + author: Frank Li + authorURL: https://twitter.com/foobarbaz + authorFBID: 503283835 + title: New Blog Post + --- -Lorem Ipsum... -``` + Lorem Ipsum... + ``` -For more information about blog posts, click [here](https://docusaurus.io/docs/en/adding-blog) +More information about [blog posts](https://docusaurus.io/docs/en/adding-blog). ## Adding items to your site's top navigation bar 1. Add links to docs, custom pages or external links by editing the headerLinks field of `website/siteConfig.js`: -`website/siteConfig.js` -```javascript -{ - headerLinks: [ - ... - /* you can add docs */ - { doc: 'my-examples', label: 'Examples' }, - /* you can add custom pages */ - { page: 'help', label: 'Help' }, - /* you can add external links */ - { href: 'https://github.com/facebook/docusaurus', label: 'GitHub' }, - ... - ], - ... -} -``` - -For more information about the navigation bar, click [here](https://docusaurus.io/docs/en/navigation) + ```javascript + { + headerLinks: [ + ... + /* you can add docs */ + { doc: 'my-examples', label: 'Examples' }, + /* you can add custom pages */ + { page: 'help', label: 'Help' }, + /* you can add external links */ + { href: 'https://github.com/facebook/docusaurus', label: 'GitHub' }, + ... + ], + ... + } + ``` + +More information about the [navigation bar](https://docusaurus.io/docs/en/navigation). ## Adding custom pages 1. Docusaurus uses React components to build pages. The components are saved as .js files in `website/pages/en`: 1. If you want your page to show up in your navigation header, you will need to update `website/siteConfig.js` to add to the `headerLinks` element: -`website/siteConfig.js` -```javascript -{ - headerLinks: [ - ... - { page: 'my-new-custom-page', label: 'My New Custom Page' }, - ... - ], - ... -} -``` + ```javascript + { + headerLinks: [ + ... + { page: 'my-new-custom-page', label: 'My New Custom Page' }, + ... + ], + ... + } + ``` -For more information about custom pages, click [here](https://docusaurus.io/docs/en/custom-pages). +More information about [custom pages](https://docusaurus.io/docs/en/custom-pages). -# Full Documentation +## Full Documentation Full documentation can be found on the [website](https://docusaurus.io/). diff --git a/website/blog/2016-03-11-blog-post.md b/website/blog/2016-03-11-blog-post.md old mode 100755 new mode 100644 diff --git a/website/blog/2017-04-10-blog-post-two.md b/website/blog/2017-04-10-blog-post-two.md old mode 100755 new mode 100644 diff --git a/website/blog/2017-09-25-testing-rss.md b/website/blog/2017-09-25-testing-rss.md old mode 100755 new mode 100644 diff --git a/website/blog/2017-09-26-adding-rss.md b/website/blog/2017-09-26-adding-rss.md old mode 100755 new mode 100644 diff --git a/website/blog/2017-10-24-new-version-1.0.0.md b/website/blog/2017-10-24-new-version-1.0.0.md old mode 100755 new mode 100644 diff --git a/website/core/Footer.js b/website/core/Footer.js old mode 100755 new mode 100644 index c2b317c..e2a288e --- a/website/core/Footer.js +++ b/website/core/Footer.js @@ -69,7 +69,8 @@ class Footer extends React.Component { <div> <h5>More</h5> <a href={`${this.props.config.baseUrl}blog`}>Blog</a> - <a href="https://github.com/">GitHub</a> + <a href="https://gitlab.com/pages/docusaurus" target="_blank">Built by GitLab Pages</a> + <a href="https://github.com/facebook/docusaurus" target="_blank">Docusaurus on GitHub</a> <a className="github-button" href={this.props.config.repoUrl} diff --git a/website/pages/en/help.js b/website/pages/en/help.js old mode 100755 new mode 100644 diff --git a/website/pages/en/index.js b/website/pages/en/index.js old mode 100755 new mode 100644 index 77d657a..9d33cc0 --- a/website/pages/en/index.js +++ b/website/pages/en/index.js @@ -64,7 +64,7 @@ class HomeSplash extends React.Component { <div className="inner"> <ProjectTitle siteConfig={siteConfig} /> <PromoSection> - <Button href="#try">Try It Out</Button> + <Button href="https://gitlab.com/pages/docusaurus" target="_blank">Host it yourself</Button> <Button href={docUrl('doc1.html')}>Example Link</Button> <Button href={docUrl('doc2.html')}>Example Link 2</Button> </PromoSection> diff --git a/website/pages/en/users.js b/website/pages/en/users.js old mode 100755 new mode 100644 diff --git a/website/sidebars.json b/website/sidebars.json old mode 100755 new mode 100644 diff --git a/website/siteConfig.js b/website/siteConfig.js index 6d7e1cd..ac806ae 100644 --- a/website/siteConfig.js +++ b/website/siteConfig.js @@ -11,27 +11,27 @@ // List of projects/orgs using your project for the users page. const users = [ { - caption: 'User1', + caption: 'GitLab', // You will need to prepend the image path with your baseUrl // if it is not '/', like: '/test-site/img/image.jpg'. image: '/img/undraw_open_source.svg', - infoLink: 'https://www.facebook.com', + infoLink: 'https://about.gitlab.com', pinned: true, }, ]; const siteConfig = { - title: 'Test Site', // Title for your website. - tagline: 'A website for testing', - url: 'https://johncoghlan.gitlab.io', // Your website URL - baseUrl: '/docs/', // Base URL for your project */ + title: 'GitLab Pages', // Title for your website. + tagline: 'A website built by GitLab Pages', + url: 'https://pages.gitlab.io', // Your website URL + baseUrl: '/docusaurus/', // Base URL for your project */ // For github.io type URLs, you would set the url and baseUrl like: // url: 'https://facebook.github.io', // baseUrl: '/test-site/', // Used for publishing and more - projectName: 'test-site', - organizationName: 'facebook', + projectName: 'docusaurus', + organizationName: 'GitLab', // For top-level user or org sites, the organization is still the same. // e.g., for the https://JoelMarcey.github.io site, it would be set like... // organizationName: 'JoelMarcey' @@ -73,7 +73,7 @@ const siteConfig = { */ // This copyright info is used in /core/Footer.js and blog RSS/Atom feeds. - copyright: `Copyright © ${new Date().getFullYear()} Your Name or Your Company Name`, + copyright: `Copyright © ${new Date().getFullYear()} GitLab`, highlight: { // Highlight.js theme to use for syntax highlighting in code blocks. diff --git a/website/static/css/custom.css b/website/static/css/custom.css old mode 100755 new mode 100644 diff --git a/website/static/img/favicon.ico b/website/static/img/favicon.ico old mode 100755 new mode 100644 diff --git a/website/static/img/oss_logo.png b/website/static/img/oss_logo.png old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_code_review.svg b/website/static/img/undraw_code_review.svg old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_monitor.svg b/website/static/img/undraw_monitor.svg old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_note_list.svg b/website/static/img/undraw_note_list.svg old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_online.svg b/website/static/img/undraw_online.svg old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_open_source.svg b/website/static/img/undraw_open_source.svg old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_operating_system.svg b/website/static/img/undraw_operating_system.svg old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_react.svg b/website/static/img/undraw_react.svg old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_tweetstorm.svg b/website/static/img/undraw_tweetstorm.svg old mode 100755 new mode 100644 diff --git a/website/static/img/undraw_youtube_tutorial.svg b/website/static/img/undraw_youtube_tutorial.svg old mode 100755 new mode 100644 -- GitLab