1
0
mirror of https://github.com/trambarhq/relaks-wordpress-example.git synced 2025-09-24 22:41:31 +02:00

Fixed archive links.

Fixed media view.
Fixed route to tag pages.
This commit is contained in:
Chung Leong
2019-01-31 23:08:31 +01:00
parent 4fc2594a9d
commit f2d788a4e4
4 changed files with 21 additions and 6 deletions

View File

@@ -152,6 +152,13 @@ class Route {
if (post) {
return { pageType: 'post', postSlug, siteURL };
}
// see if it's pointing to a tag when no prefix is used
let tagSlug = _.last(slugs);
tag = await wp.fetchTag(tagSlug);
if (tag) {
return { pageType: 'tag', tagSlug: tag.slug, siteURL };
}
}
async loadPageData(url) {
@@ -186,6 +193,7 @@ class Route {
let { siteURL } = this.params;
let siteURLInsecure = 'http:' + siteURL.substr(6);
if (node.name === 'a') {
node.attribs.href = _.trim(node.attribs.href);
if (node.attribs.href) {
if (!_.startsWith(node.attribs.href, '/')) {
if (_.startsWith(node.attribs.href, siteURL)) {

View File

@@ -39,7 +39,8 @@ A {
margin-right: -0.4em;
text-shadow: 0 0 0 #fff;
cursor: pointer;
transition: text-shadow 1s, color 1s;
transition: text-shadow 1s, color 1s, opacity 0.5s;
color: #cccccc;
&:link, &:visited {
color: #cccccc;
@@ -59,6 +60,10 @@ A {
&.disabled {
opacity: 0.5;
cursor: default;
&:hover {
opacity: 0.5 !important;
}
}
&.highlighted {

View File

@@ -9,7 +9,7 @@ class MediaView extends PureComponent {
let { media, size } = this.props;
let info = _.get(media, [ 'media_details', 'sizes', size ]);
if (!info) {
return;
info = media;
}
let props = {
src: info.source_url,

View File

@@ -299,13 +299,15 @@ class SideNavSync extends PureComponent {
let { date } = route.params;
let className, url;
if (monthEntry.year === selectedYear) {
if (date && monthEntry.month === date.month) {
className = 'selected';
}
let postList = _.find(postLists, { monthEntry });
if (!postList || !_.isEmpty(postList.posts)) {
url = route.prefetchArchiveURL(monthEntry);
}
if (date && monthEntry.month === date.month) {
className = 'selected';
} else {
className = 'disabled';
}
}
return (