Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolNet committed Nov 17, 2023
2 parents 78e2580 + fa39005 commit 44f932d
Show file tree
Hide file tree
Showing 58 changed files with 23,923 additions and 4,299 deletions.
3 changes: 3 additions & 0 deletions .flotiq/.env.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FLOTIQ_API_KEY=
SCOPED_FLOTIQ_API_KEY=YOUR_SCOPED_FOR_POSTS_SEARCH_FLOTIQ_API_KEY
GA_TRACKING_ID=YOUR_GA_TRACKING_KEY
10 changes: 6 additions & 4 deletions .flotiq/ContentType3/ContentTypeDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"items": {
"$ref": "#/components/schemas/DataSource"
},
"minItems": 0
"minItems": 1
},
"title": {
"type": "string",
Expand All @@ -30,7 +30,7 @@
"items": {
"$ref": "#/components/schemas/DataSource"
},
"minItems": 0
"minItems": 1
},
"status": {
"type": "string",
Expand Down Expand Up @@ -101,7 +101,9 @@
"status",
"excerpt",
"metaDescription",
"content"
"content",
"tags",
"author"
],
"additionalProperties": false
},
Expand Down Expand Up @@ -187,7 +189,7 @@
"headerImage": {
"label": "Header Image",
"unique": false,
"helpText": "",
"helpText": "Recommended size 1920x1080 (16:9)",
"inputType": "datasource",
"validation": {
"relationContenttype": "_media"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@
}
}
}
}
}
10 changes: 10 additions & 0 deletions .flotiq/ContentType6/ContentTypeDefinition.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"github_url": {
"type": "string"
},
"reddit_url": {
"type": "string"
},
"description": {
"type": "string"
},
Expand Down Expand Up @@ -139,6 +142,7 @@
"twitter_url",
"facebook_url",
"linkedin_url",
"reddit_url",
"privacy_policy_page",
"terms_of_service_page",
"cookie_policy_page",
Expand All @@ -165,6 +169,12 @@
"helpText": "",
"inputType": "text"
},
"reddit_url": {
"label": "Reddit url",
"unique": false,
"helpText": "",
"inputType": "text"
},
"description": {
"label": "Description",
"unique": false,
Expand Down
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Production
name: Deploy production
# Controls when the action will run. Triggers the workflow on push
# events but only for the master branch
on:
Expand All @@ -18,27 +18,27 @@ jobs:
echo FLOTIQ_BASE_URL=https://api.flotiq.com >> .env.production
echo FLOTIQ_API_KEY="$FLOTIQ_API_KEY" >> .env.production
echo SCOPED_FLOTIQ_API_KEY="$SCOPED_FLOTIQ_API_KEY" >> .env.production
echo GA_TRACKING_ID="$GA_TRACKING_ID" >> .env.production
echo GA_MEASUREMENT_ID="$GA_MEASUREMENT_ID" >> .env.production
shell: bash
env:
FLOTIQ_API_KEY: ${{ secrets.FLOTIQ_API_KEY }}
SCOPED_FLOTIQ_API_KEY: ${{ secrets.SCOPED_FLOTIQ_API_KEY }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}

- uses: actions/setup-node@v1
with:
node-version: '14'
- run: npm install
- run: yarn install

- name: Gatsby
run: |
npm install -g gatsby-cli
npm install -g gatsby-cli@4.25.0
gatsby clean
gatsby build --prefix-paths
rm -rf public/blog
mkdir -p public/blog
find public/ -maxdepth 1 -mindepth 1 -not -name blog -exec mv '{}' public/blog/ \;
# find public/blog -name index.html -exec sed -i 's\window.pagePath="\window.pagePath="/blog\g' {} \;
- name: Cloudflare
run: |
npm install -g @cloudflare/wrangler
Expand All @@ -53,9 +53,13 @@ jobs:
mkdir -p /home/runner/.wrangler/config/
echo api_token = '"'"$API_TOKEN"'"' > /home/runner/.wrangler/config/default.toml
cat wrangler.toml
cp worker-index.js workers-site/index.js
wrangler publish --env=production
# Refresh sitemap in Google and Bing
curl "https://www.google.com/webmasters/sitemaps/ping?sitemap=https://flotiq.com/blog/sitemap/sitemap-index.xml"
curl "https://www.bing.com/webmaster/ping.aspx?siteMap=https://flotiq.com/blog/sitemap/sitemap-index.xml"
shell: bash
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
ZONE_ID: ${{ secrets.ZONE_ID }}
ZONE_ID: ${{ secrets.ZONE_ID }}
31 changes: 17 additions & 14 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Staging
name: Deploy staging
# Controls when the action will run. Triggers the workflow on push
# events but only for the master branch
on:
Expand All @@ -18,44 +18,47 @@ jobs:
echo FLOTIQ_BASE_URL=https://api.flotiq.com >> .env.production
echo FLOTIQ_API_KEY="$FLOTIQ_API_KEY" >> .env.production
echo SCOPED_FLOTIQ_API_KEY="$SCOPED_FLOTIQ_API_KEY" >> .env.production
echo GA_TRACKING_ID="$GA_TRACKING_ID" >> .env.production
echo GA_MEASUREMENT_ID="$GA_MEASUREMENT_ID" >> .env.production
shell: bash
env:
FLOTIQ_API_KEY: ${{ secrets.FLOTIQ_API_KEY }}
SCOPED_FLOTIQ_API_KEY: ${{ secrets.SCOPED_FLOTIQ_API_KEY }}
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }}
GA_MEASUREMENT_ID: ${{ secrets.GA_MEASUREMENT_ID }}

- uses: actions/setup-node@v1
with:
node-version: '14'
- run: npm install
- run: yarn install

- name: Gatsby
run: |
npm install -g gatsby-cli
npm install -g gatsby-cli@4.25.0
gatsby clean
gatsby build --prefix-paths
rm -rf public/blog
mkdir -p public/blog
find public/ -maxdepth 1 -mindepth 1 -not -name blog -exec mv '{}' public/blog/ \;
rm -rf public/blog-staging
mkdir -p public/blog-staging
find public/ -maxdepth 1 -mindepth 1 -not -name blog-staging -exec mv '{}' public/blog-staging/ \;
- name: Cloudflare
run: |
npm install -g @cloudflare/wrangler
wrangler init --site flotiq-blog
wrangler init --site flotiq-blog-staging
sed -i 's+account_id = '\'\''+account_id = '"'"$ACCOUNT_ID"'"'+g' wrangler.toml
sed -i 's+bucket = ""+bucket = "public"+g' wrangler.toml
sed -i 's+zone_id = '\'\''+zone_id = '"'"$ZONE_ID"'"'+g' wrangler.toml
sed -i 's+workers_dev = true++g' wrangler.toml
echo "[env.staging]" >> wrangler.toml
echo "route = 'staging.flotiq-blog-production.cdwv.workers.dev'" >> wrangler.toml
echo "[env.production]" >> wrangler.toml
echo "route = 'flotiq.com/blog-staging/*'" >> wrangler.toml
echo 'zone_id = '"'"$ZONE_ID"'" >> wrangler.toml
mkdir -p /home/runner/.wrangler/config/
echo api_token = '"'"$API_TOKEN"'"' > /home/runner/.wrangler/config/default.toml
cat wrangler.toml
wrangler publish --env=staging
cp worker-index.js workers-site/index.js
wrangler publish --env=production
# Refresh sitemap in Google and Bing
curl "https://www.google.com/webmasters/sitemaps/ping?sitemap=https://flotiq.com/blog-staging/sitemap/sitemap-index.xml"
curl "https://www.bing.com/webmaster/ping.aspx?siteMap=https://flotiq.com/blog-staging/sitemap/sitemap-index.xml"
shell: bash
env:
API_TOKEN: ${{ secrets.API_TOKEN }}
ACCOUNT_ID: ${{ secrets.ACCOUNT_ID }}
ZONE_ID: ${{ secrets.ZONE_ID }}
ZONE_ID: ${{ secrets.ZONE_ID }}
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Screenshot

```bash
npm install -g flotiq-cli
flotiq start [flotiqApiKey] [projectName] https://github.com/flotiq/flotiq-blog.git
flotiq start [projectName] https://github.com/flotiq/flotiq-blog.git [flotiqApiKey]
```
* `flotiqApKey` - Read and write API key to your Flotiq account
* `projectName` - project name or project path (if you wish to start or import data from the current directory - use `.`)
Expand All @@ -38,7 +38,7 @@ Screenshot
If you wish to import example posts, tags and authors to your account, before running `gatsby develop` run:

```sh
flotiq import [flotiqApiKey] .
flotiq import . [flotiqApiKey]
```

It will add 4 images, 1 tag, 1 author and 3 posts to your Flotiq account.
Expand All @@ -54,7 +54,7 @@ Screenshot
```
FLOTIQ_API_KEY=YOUR FLOTIQ API KEY
SCOPED_FLOTIQ_API_KEY=YOUR SCOPED FOR POSTS SEARCH FLOTIQ API KEY
GA_TRACKING_ID=YOUR GA TRACKING KEY
GA_MEASUREMENT_ID=YOUR GA4 MEASUREMENT ID
```

`FLOTIQ_API_KEY` should be the Read-only Application key and `SCOPED_FLOTIQ_API_KEY` should be Scoped User key with read-only access to blog posts, media, tags and authors.
Expand All @@ -65,7 +65,7 @@ Screenshot

```sh
cd flotiq-blog
npm install
yarn install
gatsby develop
```

Expand Down
11 changes: 11 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,14 @@ require('@fontsource/inter/latin-ext-500.css');
require('@fontsource/inter/latin-700.css');
require('@fontsource/inter/latin-ext-700.css');
require('./src/style/app.scss');

exports.onInitialClientRender = () => {
window.scrollTo(0, 0);
};

exports.shouldUpdateScroll = (prevRouterProps, { location }) => {
window.scrollTo(0, 0);
const body = document.getElementsByTagName('body')[0];
body.scrollTop = 0;
return false;
};
36 changes: 18 additions & 18 deletions gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,22 @@ module.exports = {
plugins: [
'gatsby-plugin-sass',
{
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: process.env.GA_TRACKING_ID || '',
// Puts tracking script in the head instead of the body
head: true,
// IP anonymization for GDPR compliance
anonymize: true,
// Disable analytics for users with `Do Not Track` enabled
respectDNT: true,
// Avoids sending pageview hits from custom paths
exclude: ['/preview/**'],
// Specifies what percentage of users should be tracked
sampleRate: 100,
// Determines how often site speed tracking beacons will be sent
siteSpeedSampleRate: 10,
},
},
resolve: 'gatsby-plugin-google-gtag',
options: {
trackingIds: [
process.env.GA_MEASUREMENT_ID, // GA Measurement
],
gtagConfig: {
optimize_id: 'OPT_CONTAINER_ID',
anonymize_ip: true,
cookie_expires: 0,
},
pluginConfig: {
head: true,
respectDNT: true,
},
},
},
'gatsby-plugin-react-helmet',
'gatsby-plugin-sitemap',
{
Expand All @@ -40,9 +39,10 @@ module.exports = {
authToken: process.env.FLOTIQ_API_KEY,
timeout: 30000,
downloadMediaFile: true,
forceReload: true,
forceReload: false,
includeTypes: [
'_media',
'_tag',
'flotiq_main_settings',
'static_pages',
'flotiqBlogAuthor',
Expand Down
3 changes: 2 additions & 1 deletion gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ exports.createPages = async ({ graphql, actions }) => {

const result = await graphql(`
query MainQuery {
allFlotiqBlogPost(sort: {fields: publish_date, order: DESC}, limit: 10000) {
allFlotiqBlogPost(sort: {fields: publish_date, order: DESC}, limit: 10000, filter: {status: {eq: "public"}}) {
edges {
node {
id
slug
status
tags {
id
tag
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@
"@restart/ui": "0.2.3",
"babel-eslint": "^10.1.0",
"bootstrap": "^4.6.0",
"flotiq-components-react": "^0.4.13",
"gatsby": "^4.4.0",
"gatsby-plugin-disqus": "^1.2.3",
"gatsby-plugin-google-analytics": "^4.4.0",
"gatsby-plugin-google-gtag": "4",
"gatsby-plugin-hotjar": "^1.1.1",
"gatsby-plugin-image": "^2.4.0",
"gatsby-plugin-manifest": "^4.4.0",
Expand All @@ -31,7 +32,7 @@
"gatsby-plugin-sharp": "^4.4.0",
"gatsby-plugin-sitemap": "^5.4.0",
"gatsby-source-filesystem": "^4.4.0",
"gatsby-source-flotiq": "^4.1.3",
"gatsby-source-flotiq": "^4.1.5",
"gatsby-transformer-sharp": "^4.4.0",
"highlight.js": "^11.3.1",
"lodash": "^4.17.21",
Expand Down
Loading

0 comments on commit 44f932d

Please sign in to comment.