How migrate categorizes URLS in Ghost CMS? - jekyll

Currently I'm using Jekyll with urls like
article/<category>/<year>/<month>/<date>/<title> and sometimes
article/<category>/<subcategory>/<year>/<month>/<date>/<title>
How can I now move to Ghost (tryghost.org) CMS on my own server and keep those URLs or use redirects?

Related

Why are the Kroki-generated images in my Backstage TechDocs site broken?

I am generating a TechDocs site for my Backstage server using the recommended approach with the techdocs-cli generate and publish commands in a CI/CD pipeline. I am also using the kroki plugin. My mkdocs.yaml includes the following:
plugins:
- techdocs-core
- kroki:
DownloadImages: true
FencePrefix: ''
HttpMethod: POST
ServerURL: http://localhost:8000
The generated .html files include links to generated images that look like <img alt="Kroki" src="/images/kroki_generated/<file>-<hash>.svg" />. Those svg files are present in the images/kroki_generated directory and the whole directory structure is published to an Azure storage account.
My Backstage server is deployed with the app-backend plugin and I'm accessing it at the root of a domain like https://techhub.example.com/
When I go to the page in the docs site in backstage, for example https://techhub.example.com/docs/default/component/<component name>/<document>/, the images are broken. The browser devtools are showing requests to https://techhub.example.com/images/kroki_generated/<file>-<hash>.svg which returns the Backstage app's home page HTML rather than retrieving the actual svg through the techdocs backend API.
How can I get the combination of TechDocs, MkDocs and the kroki plugin to work together properly?
This was caused by a defect in the MkDocs Kroki plugin which was fixed with https://github.com/AVATEAM-IT-SYSTEMHAUS/mkdocs-kroki-plugin/pull/20

HTML file structure's affect on website URL

I currently have a simple website, hosted on github pages with a file structured in hierarchical directories as shown below:
/foobar.com
/css
/js
/images
/html
/news
/news_content
fizz.html
buzz.html
news.html
about.html
contact.html
index.html
However, when I am on the buzz webpage for example, this has resulted in the URL to become:
https://foobar.com/html/news/news_content/buzz.html
Is there a way to change this URL so that it doesn't show all the folder directories and instead, just the file itself i.e. https://foobar.com/buzz.html as I don't want to separate all the individual HTML files into separate folders?
Yes, you can change the URL to be more user-friendly by using server-side URL rewriting or client-side JavaScript.
For server-side URL rewriting, you'll need to use a web server such as Apache or Nginx and configure it to rewrite the URLs. You can find more information on how to do this for Apache or Nginx by searching for "URL rewriting" on their websites or forums.
For client-side URL rewriting, you can use JavaScript to manipulate the URL shown in the browser's address bar. However, this method may not be ideal for search engines or users who have JavaScript disabled.
If you are using GitHub Pages to host your website, you might be able to achieve URL rewriting by using Jekyll. Jekyll is a static site generator that supports URL rewriting and can be used in combination with GitHub Pages to host your website. You can find more information on how to do this by searching for "Jekyll URL rewriting."
How a URL is resolved to a resource depends on the HTTP server and/or the server side programming language you are using.
Github Pages provides no features that allow anything other than a direct reflection of the directory layout in the URL.
The closest you could come would be to write a program that transformed the input (the file structure you want to work with) into the file structure that Github Pages will express as the URLs you desire (and then run it as a build step that takes the pages out of your working branch and into your gh-pages branch; possibly you could use actions to do this).

Vue-Nuxt: Why can't I see the generated HTMLs correctly?

So when I type npm run generate Nuxt generates my project into the dist folder. In that folder I can find a folder called _nuxt where I have .js files and the index.html file but when I open it in a browser it doesn't show anything.
So, my question is: Aren't those static files?
When you work with the CDN served vue.js you have the html file and you click and everything is showed on the browser because those .html files are static, they don't need an internal localhost server. Why npm run generate doesn't do the same? Or how can I see those generated files?
As #aljazerzen explained, Vue,js doesn't do SSR out of the box, one of the aims of Nuxt.js is to provide SSR for you, as a benefit you can also generate a static version of your website. If I get what you want correctly, what you want to do is that when you open your index.html (the one that Nuxt.js generates for you) you can see your functional webpage. When you're accessing your website as a file:/// url, your browser (at least I've seen it happen with Chrome) doesn't load your .js files.
I don't have any Nuxt generated websites at hand so I can't tell you exactly why this happen. But this is my guess: when Nuxt generate those files it gives them a src that can't be accessed as file:///, maybe something as /your_js.js, that when it tries to load it, thinks it's the / of the root folder instead of relative to your website's root (/).
The solution to this problem is to serve your assets using any web server. According to Nuxt.js's documentation:
nuxt generate :Build the application and generate every route as a HTML file (used for static hosting).
You could do a quick test and use a simple web server by typing:
python -m http.server
In the folder that contains your generated assets.
Hope this helps!
Nuxt uses server side rendering.
You can read more here.
To generate static HTML files, run:
nuxt generate
Explanation: Vanilla Vue.js application is rendered only when the page loads and JavaScript can start running. This means that some clients that do not have JavaScript enabled (web crawlers) won't see the page. Also for a brief second before Vue.js can render the page, there is blank screen, when plain HTML files could already be visible.
Now, server-side rendering (SSR) is a technique for rendering a single page app (SPA) on the server and then sending a fully rendered page to the client. The client’s JavaScript bundle can then take over and the SPA can operate as normal.
This can also help with SEO and with providing meta data to social media channels.
But on the downside (as you mentioned), such application cannot be hosted at a CDN, since you have to have a Node.js process running to render the page.
In my opinion, SSR is redundant with SPAs if what you are building is actually an application and not a website. A website should mostly display information and should not be interactive. It should leverage web-based mechanisms such as links, cookies and plain HTML with CSS. In the contrast, web application (eg. Vue.js application) should be more like a mobile application: it is larger to download, but performs better and offers much more interactive experience. Such application does not need server-side rendering, since we can wait for it to load a bit more and because it shouldn't be indexed by search engines (it is not a website).

How do I get a largely HTML site generated from a rails app?

I would like to create a Rails 4 app, where some data is entered into the db via a form and when it is published, any changes on the site are compiled and the entire consumer facing site is just a bunch of flat HTML files.
That way, on each request there isn't a db request done and just a simple HTML file is sent.
This is similar to the way Octopress operates, where you write a blog post locally and when you do a deploy it basically compiles the entire site into a large set of connected HTML files that are then pushed to your host(gh-pages for instance).
Is there a way to use extensive caching or something similar to get the same effect in Rails 4 or should I go about it another way in Rails or should I just try to customize Octopress for my needs?
Have a look at page caching, it has been moved from Rails to a separate gem
https://github.com/rails/actionpack-page_caching
It saves the generated HTML files to a specified directory which you should be able to deploy separately from the rest of the application.

Consume an RSS Feed for Syndication in Jekyll

I have two jekyll web sites, and I want to syndicate some of the content (one of the categories) from the source blog to the receiving blog via syndication.
I can see how RSS feeds are automatically created with jekyll, but how does one consume them on another site - so that it looks like those posts are from that second site?
Can I do this in jekyll?
The biggest problem is that you jekyll is a static website generator. So you can't do this automatically inside of Jekyll. However, there are two options:
You would need to setup a cron script of some sort that pulls down the RSS feed, creates the jekyll files, runs the jekyll command and uploads it to the web. This can all be automated.
You could use javascript to display this all. This would basically be writing your own java script (or modifying one you found on the internet). You could use something like this: http://code.google.com/p/jsrss/