Why can't Jekyll Minima point to correct post's permalink? - github

I recently just set up a GitHub Pages. Hooray! This is very exciting for me.
I've been having endless issues with inserting the baseurl for the "post" layout; not for anything else (e.g. default, page). I have no idea why.
Here's the setup:
url: "https://[user].github.io" # the base hostname & protocol for your site, e.g. http://example.com
# this means to ignore newlines until "baseurl:"
baseurl: "/portfolio" # the subpath of your site, e.g. /blog
For "page" layout, I have the following:
---
layout: page
title: About
permalink: /about
---
# About page
This page tells you a little bit about me.
No issue - https://[user].github.io/portfolio/about
With a post, however, I've coded the following:
---
layout: post
title: "Space Race Project"
date: 2023-02-11 17:09:05 -0500
categories: excel
# permalink: /:categories/:title/
---
And the result - http://[user].github.io/python/pet-sales/
Why is it excluding the baseurl, "portfolio?" It leads to a 404 error.
Any help would be so appreciated.

Related

Swagger Open api : add link to schema in description [duplicate]

I'm writing a Swagger specification for an future public API that requires a very detailed and clean documentation. Is there a way to reference/link/point to another endpoint at some other location in the swagger.yml file?
For example, here is what I am trying to achieve:
paths:
/my/endpoint:
post:
tags:
- Some tag
summary: Do things
description: >
This endpoint does things.
See /my/otherEndpoint for stuff # Here I would like to have some kind of hyperlink
operationId: doThings
consumes:
- application/json
produces:
- application/json
parameters:
...
responses:
...
/my/otherEndpoint: # This is the endpoint to be referenced to
get:
...
I have found that $ref does not help because it simply replaces itself with the contents of the reference.
Can Swagger do such a thing?
Swagger UI provides permalinks for tags and operations if it's configured with the deepLinking: true option. These permalinks are generated based on the tag names and operationId (or if there are no operationId - based on the endpoint names and HTTP verbs).
index.html#/tagName
index.html#/tagName/operationId
You can use these permalinks in your Markdown markup:
description: >
This endpoint does things.
See [/my/otherEndpoint](#/tagName/myOtherEndpointId) for stuff
Notes:
Markdown links (such as above) currently open in a new browser tab (as with target="_blank") - see issue #3473.
HTML-formatted links foobar currently don't work.
Swagger Editor does not support such permalinks.

TYPO3 v9.5.8 - 404 errorHandling works only on second level - How to fix it?

I have a really strange behaviour in my TYPO3 CMS v9.5.8
Inside the site settings i configured the errorHandler for 404 pages as follows
rootPageId: 1
base: 'http://www.example.com/'
[...]
errorHandling:
-
errorCode: '404'
errorHandler: Page
errorContentSource: 't3://page?uid=97'
when i now try to open http://www.example.com/foo (which does not exist) the Site shows me the root page (id:1, same as example.com).
BUT if I access http://www.example.com/foo/bar or http://www.example.com/foo/baz or any other non-existent second level site - then I see the configured 404 site (id:97).
What could go wrong here? How can get the "normal" 404 behaviour?
EDIT: I figured out, that foo can be both. Existent and non existent. The important thing is: before the non existent subsite (lvl 3, 4, 5, 6, ...), there has to be a domain (lvl 1) and at least a lvl 2 subpage.

how to set one value for few key's in YAML object

As far as I know there is no way to attach few keys to the single value in {key : value} pair in YAML.
I am new to Swagger documentation (OpenAPI 3.0) and wondering is it possible somehow to combine my values together.
For instance, I am messing with REST API documentation and when I want to list few responses without rewriting it every time, I have the following :
paths:
/users:
post:
//some additional information here
responses:
'500':
//and for example here I want to add not only 201 status code but also others
description: >-
Something went wrong on back end
//however I have to do something like this (writing them all)
'502':
description: >-
Something went wrong on back end
//and so on..
What is best practices to overcome that? Maybe I have a bad point from the beginning.
You can use anchors and aliases:
path:
/users:
responses:
'500':
description: &desc1 >-
Something went wrong on back end
'502':
description: *desc1
OpenAPI 3.0 supports response ranges '1XX'-'5XX' that can be used instead of listing the codes individually:
responses:
'5XX':
description: Something went wrong on back end
If you still want to list the response codes individually but they have the same description and schema, you can $ref the common response definition like so:
responses:
'501':
$ref: '#/components/schemas/BackendErrorResponse'
'502':
$ref: '#/components/schemas/BackendErrorResponse'
components:
responses:
BackendErrorResponse:
description: Something went wrong on back end
content:
application/json:
schema:
...
There's also an enhancement request in the OpenAPI Specification repository to allow reusing description across different responses.

Apache Sling Resource Mapping in CQ 5.6.1

I've been taking several hours fiddling this Resource Mapping for no luck. I have put a new node in /etc/map/http named GoogleAnalyticsMap. It had the following properties:
Name: jcr:primaryType
Type: Name
Value: sling:Mapping
Name: sling:internalRedirect
Type: String
Value: /content/dam/website/Common/my_google_analytics_key.html
Name: sling:match
Type: String
Value: [^/]+/[^/]+/my_google_analytics_key.html
Funnily, when i checked to /system/console/jcrresolver or Adobe CQ Web Console Sling Resource Resolver. It resolves into the following
Pattern: ^http/[^/]+/[^/]+/my_google_analytics_key.html
Replacement: /content/dam/website/Common/my_google_analytics_key.html
Redirect: internal
I have no idea how they could register ^[^/]+/[^/]+/welcome$ as shown in the example and did not have the 'http' there. Nevertheless, whenever i try to hit the pattern locally (i.e. http://localhost:4502/my_google_analytics_key.html) it only shows resource not found. Also checked through the Configuration test section that available in Adobe CQ Web Console Sling Resource Resolver it says that it can't resolve. Did i miss something?
, type=sling:nonexisting, path=/my_google_analytics_key.html, resource=[NonExistingResource, path=/my_google_analytics_key.html]
Thank you for the help.
p.s. i've checked the Sling documentation also, however, it baffles me that i can't add sling:alias, perhaps its also something to do with the sling version. Nevertheless, i should ask this as second question later, once the sling:match is working properly.
Edit: fiddling a bit, changing the sling:match to localhost.4502/google.html does let it to redirect localhost:4502/google.html to the desired DAM item. Well, i'm still asking for 'domain-free' matching though.. so i have no trouble when using the mapping for all environment i have..
Edit, Updates:
Apparently due to me put the new sling:Mapping under http folder it will always prefix the path with http. Perhaps the example is meant to be put not under http folder.
Next item is, it will always assume the matching item will be protocols, domain, and port separated by dots (yes, even \. is not a valid input and CQ or rather sling will sanitize it somehow). Something like *.(4502|4503|80|443)/my_google_analytics_key.html will accept any domains and those designated ports. I do wonder if it really the case, since they says regex but it does not feel so much regex.
Some says that sling:internalRedirect should be a String[] - yes i know the docs says String. I have not test this further and take it as it is..

Durandal JS: typing url without hash give HTTP Error 404.0 - Not Found

I am building a SPA application using Durandaljs. When I enter a URL WITHOUT hash, it shows the error: HTTP error 404.0 - NOT FOUND. However, it is working fine WITH hash.
Example:
www.domain.com/page => HTTP error 404.0 - NOT FOUND
www.domain.com/#page = > working fine.
How can I map the www.domain.com/page to www.domain.com/#page?
In order for pushState to work correctly in your app (including deep linking), you must configure the router for pushState and tell the server to ignore all but certain paths/routes.
The server should ignore paths that contain resources or services used by your SPA, and should always send the Durandal.cshtml (or whatever you name it) for these ignored routes.
These routes should be ignored even if there's additional route info in the request. This will allow for deep linking using pushState-style URLs.
Here's the MVC routing from a Durandal-based app I recently completed:
public static void RegisterRoutes(RouteCollection routes) {
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.Ignore("{resourcedir}/{*resource}",
new {resourcedir = #"(api|breeze|app|scripts|content|assets|signalr)"});
routes.MapRoute(
name: "Default",
url: "{*sparoute}",
defaults: new { controller = "Durandal", action = "Index"});
}
Basically, we're telling the server to ignore any requests that start with:
api/
breeze/
app/
scripts/
content/
assets/
signalr/
We're ignoring api, breeze and singlar because WEBApi and SignalR will handle those requests. Also, app, scripts, content, and assets are ignored because the underlying ASP.NET engine will serve those requests.
The final statement (routes.MapRoute) causes all non-ignored requests to send back the default page (the only real page in the SPA).
For example, www.domain.com/page will send the same response from the server as if you'd asked for www.domain.com/. Once the SPA loads and Durandal's router/history has initialized, the suffix is converted to hash if needed (like you're using IE) and is then dispatched through the router.
Note that if your application is not rooted at /, you need to specify the root path. You should also include hashChange: true so that your application works in IE, like this:
router.activate({ pushState: true, hashChange: true, root: '/approot' })
You can, I'm using it in my latest Durandal site which is based on the DurandalAuth template.
When you are initializing your router, set pushState: true, like this:
return router.map([
{ route: 'somroute', moduleId: 'somroute', title: 'Home', nav: true, hash: "#somroute" }
])
.buildNavigationModel()
.mapUnknownRoutes("notfound", "notfound")
.activate({ pushState: true });
You can see a working example on my site: noadou