refactor: move to blog.ipfs.tech

Closes #417
This commit is contained in:
Marcin Rataj
2022-08-15 23:19:45 +02:00
parent 084cbc9348
commit 028e67fc64
10 changed files with 40 additions and 19 deletions

View File

@@ -32,7 +32,7 @@ fields:
Data is saved in the </em><a href="https://github.com/ipfs/ipfs-blog" title=""
target="_blank"><em>ipfs/ipfs-blog</em></a><em> public GitHub repo as soon as
you hit the save button. So any sensitive information will also be publicly available
on GitHub, but hidden from the website blog.ipfs.io.</em>'
on GitHub, but hidden from the website blog.ipfs.tech.</em>'
config:
required: true
date_format: YYYY/MM/DD
@@ -59,7 +59,7 @@ fields:
page. <br><strong>Must be twice as wide as it is tall (2:1 aspect ratio) and at
least 400px tall.</strong> <strong>Name the image file something that can be easily
searched for in the media directory later (consider adding a date).</strong><br>Need
help? <a href="https://blog.ipfs.io/image-crop/" title="Use this crop/scale tool"
help? <a href="https://blog.ipfs.tech/image-crop/" title="Use this crop/scale tool"
target="_blank">Use this crop/scale tool</a> to save a revised image to your local
machine, then upload here.
- name: tags

View File

@@ -43,7 +43,7 @@ fields:
leave this blank.<br><br><strong><em>WARNING</em></strong><em>: Data is saved
in the </em><a href="https://github.com/ipfs/ipfs-blog" title="" target="_blank"><em>ipfs/ipfs-blog</em></a><em>
public GitHub repo as soon as you hit the Save button. This means anything you
save will also be publicly visible on GitHub, but not on the blog.ipfs.io site.
save will also be publicly visible on GitHub, but not on the blog.ipfs.tech site.
Be careful if you are drafting something sensitive!</em>'
config:
required: false
@@ -66,7 +66,7 @@ fields:
description: '<strong>Must be twice as wide as it is tall (2:1 aspect ratio) and
at least 400px tall.</strong> <strong>Name the image file something that can
be easily searched for in the media directory later (consider adding a date).
</strong><br>Need help? <a href="https://blog.ipfs.io/image-crop/" title="Use
</strong><br>Need help? <a href="https://blog.ipfs.tech/image-crop/" title="Use
this crop/scale tool" target="_blank">Use this crop/scale tool</a> to save a
revised image to your local machine, then upload here.<br>Video links don''t
need images: they use the video thumbnail!'

View File

@@ -19,5 +19,5 @@ jobs:
run: curl -H "Authorization:${{ secrets.FLEEK_API_KEY }}" -H "Content-Type:application/json" -d '{"query":"mutation { triggerDeploy(siteId:\"${{ secrets.FLEEK_SITE_ID }}\") { status } }"}' https://api.fleek.co/graphql
- name: Scheduled posts published
if: ${{ steps.should_publish_step.outputs.should_publish == 'true' }}
run: echo "Check https://blog.ipfs.io"
run: echo "Check https://blog.ipfs.tech"

View File

@@ -8,7 +8,7 @@
![Image of IPFS blog displayed on a laptop](https://user-images.githubusercontent.com/1507828/110040308-d2331580-7cff-11eb-8a05-8f5bad5ca819.png)
This repository contains code and content for the [IPFS Blog & News](https://blog.ipfs.io) website. To contribute to the site, please follow the instructions below for _post authors/editors_ and _site developers_.
This repository contains code and content for the [IPFS Blog & News](https://blog.ipfs.tech) website. To contribute to the site, please follow the instructions below for _post authors/editors_ and _site developers_.
**If you just want to submit a link (event, academic paper, tutorial, video or news coverage) to add to the site, [use this easy form](https://airtable.com/shrNH8YWole1xc70I)!**
@@ -16,12 +16,12 @@ This repository contains code and content for the [IPFS Blog & News](https://blo
While it's possible to manually PR a new blog post from a local build, **you are strongly encouraged to [use this site's Forestry integration](https://forestry.io) for drafting and editing new content.** Using Forestry offers you WYSIWYG editing (in addition to raw markdown mode), easy image upload/crop tools, and instant previews. If you're an IPFS core team member and don't have Forestry access, contact Jessica Schilling.
Forestry uses the `staging` branch as a work-in-progress scratchpad for blog content. Once content in `staging` is approved, it can be merged into `main`, which is the branch that feeds the production site at blog.ipfs.io. Merges into `main` are _automatically deployed_ to the production site using [Fleek](https://fleek.co/).
Forestry uses the `staging` branch as a work-in-progress scratchpad for blog content. Once content in `staging` is approved, it can be merged into `main`, which is the branch that feeds the production site at blog.ipfs.tech. Merges into `main` are _automatically deployed_ to the production site using [Fleek](https://fleek.co/).
### Forestry authoring/editing tips
- Use the "Content Types" section of Forestry's left-hand menu to drill down to the type of item (blog post, video, news coverage, event) you want to create/edit.
- For card and blog post header images, **be sure to use the [image crop/scale tool](https://blog.ipfs.io/image-crop/)** to resize and save images so they're the correct dimensions. (Don't have an image? Don't worry, there are generic fallback images.)
- For card and blog post header images, **be sure to use the [image crop/scale tool](https://blog.ipfs.tech/image-crop/)** to resize and save images so they're the correct dimensions. (Don't have an image? Don't worry, there are generic fallback images.)
- Want to embed a YouTube video in a blog post? Switch to raw markdown view and use `@[youtube](videoID)`, substituting the video's unique ID from the URL (e.g. `https://www.youtube.com/watch?v=eFbKKsEoQNg`) for `videoID`.
- To switch between WYSIWYG and raw markdown while writing a blog post, choose "Raw Editor" or "WYSIWYG Editor" from the dots menu at the top right of the page:<br/>![image](https://user-images.githubusercontent.com/1507828/110036257-fbe93e00-7cf9-11eb-935c-a70f9d21c14f.png)

View File

@@ -1,7 +1,7 @@
'use strict'
/**
The ipfs.io website requests for a blog.ipfs.io/news.json file
The ipfs.io website requests for a blog.ipfs.tech/news.json file
with the latest 3 news.
*/

View File

@@ -1,7 +1,7 @@
'use strict'
/**
The ipfs.io website requests for a blog.ipfs.io/index.json file
The ipfs.io website requests for a blog.ipfs.tech/index.json file
with the latest 4 posts.
This script parses the rss feed file index.xml and generates the
required index.json file.

View File

@@ -1,7 +1,7 @@
'use strict'
/**
The ipfs.io website requests for a blog.ipfs.io/videos.json file
The ipfs.io website requests for a blog.ipfs.tech/videos.json file
with the latest 2 videos.
*/

View File

@@ -6,9 +6,20 @@
</template>
<script>
const safePermalink = (permalink) => {
const safePermalink = (permalink, date) => {
let domain = 'https://blog.ipfs.tech/'
try {
// Use old domain for legacy comment theads
// created before we switched to the new domain
// https://github.com/ipfs/ipfs-blog/issues/417
if (new Date(date) < new Date('2022-08-15')) {
domain = 'https://blog.ipfs.io/'
}
} catch (e) {
console.error('unable to parse this.$frontmatter.date', e)
}
// https://meta.discourse.org/t/referer-with-domain-name-in-the-slug-breaks-comments-embed/204807/4?u=lidel
const url = new URL('https://blog.ipfs.io/')
const url = new URL(domain)
url.pathname = permalink
return url.toString()
}
@@ -17,18 +28,18 @@ export default {
components: {},
computed: {
embedSrc() {
return `https://discuss.ipfs.io/embed/comments?embed_url=${safePermalink(this.$frontmatter.permalink)}`
return `https://discuss.ipfs.tech/embed/comments?embed_url=${safePermalink(this.$frontmatter.permalink, this.$frontmatter.date)}`
},
},
mounted() {
window.DiscourseEmbed = {
discourseUrl: 'https://discuss.ipfs.io/',
discourseEmbedUrl: safePermalink(this.$frontmatter.permalink),
discourseUrl: 'https://discuss.ipfs.tech/',
discourseEmbedUrl: safePermalink(this.$frontmatter.permalink, this.$frontmatter.date),
}
const d = document.createElement('script')
d.type = 'text/javascript'
d.async = true
d.src = 'https://discuss.ipfs.io/javascripts/embed.js'
d.src = window.DiscourseEmbed.discourseUrl + 'javascripts/embed.js'
document.getElementsByTagName('body')[0].appendChild(d)
},
}

View File

@@ -53,6 +53,16 @@ export default {
},
},
mounted() {
// redirect blog.ipfs.io → blog.ipfs.tech (incl. gateways)
// https://github.com/ipfs/ipfs-blog/issues/417
const { href } = window.location
if (href.includes('blog.ipfs.io')) {
window.location.replace(href.replace('blog.ipfs.io', 'blog.ipfs.tech'));
}
if (href.includes('blog-ipfs-io')) { // subdomain gws
window.location.replace(href.replace('blog-ipfs-io', 'blog-ipfs-tech'));
}
// redirect routes that are not blog posts (/events, /videos, etc)
// to the homepage with the search parameter category
if (!this.isVisible && this.$root.$page.frontmatter.type) {
@@ -85,7 +95,7 @@ export default {
this.showComments =
!!ipfsPathPrefix ||
window.location.hostname.includes('.ipns.localhost') ||
window.location.hostname === 'blog.ipfs.io' ||
window.location.hostname === 'blog.ipfs.tech' ||
window.location.hostname === 'ipfs-blog.on.fleek.co' ||
window.location.hostname === 'ipfs-blog-staging.on.fleek.co'
},

View File

@@ -20,7 +20,7 @@ export function loadScript() {
var Countly = Countly || {};
Countly.q = Countly.q || [];
//provide countly initialization parameters
Countly.app_key = location.hostname === 'blog.ipfs.io' ? '9e8a52b6b06d84f50321c4c3b96ba03d4bab7717' : 'c68a0191d53e5d079372653d7d6158f0374c2172';
Countly.app_key = location.hostname === 'blog.ipfs.tech' ? '9e8a52b6b06d84f50321c4c3b96ba03d4bab7717' : 'c68a0191d53e5d079372653d7d6158f0374c2172';
Countly.url = 'https://countly.ipfs.io';
Countly.q.push(['track_sessions']);
Countly.q.push(['track_pageview']);