Skip to content

Commit

Permalink
perbaikan SEO & Loading Indikator
Browse files Browse the repository at this point in the history
  • Loading branch information
FarhannDev committed Nov 8, 2023
1 parent ceb22f5 commit 270bab1
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 92 deletions.
2 changes: 1 addition & 1 deletion app.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<NuxtLayout>
<NuxtLoadingIndicator />
<NuxtLoadingIndicator :duration="5000" color="#a60b40" />
<!-- <VitePwaManifest /> -->
<NuxtPage />
</NuxtLayout>
Expand Down
166 changes: 83 additions & 83 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default defineNuxtConfig({
viewTransition: true,
writeEarlyHints: true,
payloadExtraction: true,
emitRouteChunkError: "automatic", // or 'manual' or false.
emitRouteChunkError: 'automatic', // or 'manual' or false.
inlineRouteRules: true,
renderJsonPayloads: true,
},
Expand All @@ -24,9 +24,9 @@ export default defineNuxtConfig({
commons: true,
cacheGroups: {
styles: {
name: "styles",
name: 'styles',
test: /\.(css|vue)$/,
chunks: "all",
chunks: 'all',
enforce: true,
},
},
Expand All @@ -36,39 +36,39 @@ export default defineNuxtConfig({

// Nuxt.js modules
modules: [
"@nuxt/image",
"@nuxtjs/robots",
"nuxt-bootstrap-icons",
"nuxt-swiper",
"@nuxtjs/color-mode",
'@nuxt/image',
'@nuxtjs/robots',
'nuxt-bootstrap-icons',
'nuxt-swiper',
'@nuxtjs/color-mode',
// "@vite-pwa/nuxt",
],

plugins: [
{ src: "~/plugins/useBootstrap.client.ts", mode: "client", ssr: false },
{ src: '~/plugins/useBootstrap.client.ts', mode: 'client', ssr: false },
{
src: "~/plugins/useAnimateOnScroll.client.ts",
mode: "client",
src: '~/plugins/useAnimateOnScroll.client.ts',
mode: 'client',
ssr: false,
},
],

css: [
"~/assets/css/index.css",
"~/assets/css/custom-scrollbar.css",
"~/node_modules/bootstrap/dist/css/bootstrap.min.css",
"~/node_modules/aos/dist/aos.css",
'~/assets/css/index.css',
'~/assets/css/custom-scrollbar.css',
'~/node_modules/bootstrap/dist/css/bootstrap.min.css',
'~/node_modules/aos/dist/aos.css',
],

hooks: {
"build:manifest": (manifest) => {
'build:manifest': (manifest) => {
// find the app entry, css list
const css = manifest["node_modules/nuxt/dist/app/entry.js"]?.css;
const css = manifest['node_modules/nuxt/dist/app/entry.js']?.css;
if (css) {
// start from the end of the array and go to the beginning
for (let i = css.length - 1; i >= 0; i--) {
// if it starts with 'entry', remove it from the list
if (css[i].startsWith("entry")) css.splice(i, 1);
if (css[i].startsWith('entry')) css.splice(i, 1);
}
}
},
Expand All @@ -77,53 +77,53 @@ export default defineNuxtConfig({
app: {
head: {
meta: [
{ name: "charset", content: "utf-8" },
{ name: "viewport", content: "width=device-width, initial-scale=1" },
{ name: "theme-color", content: "#fff" },
{ name: 'charset', content: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ name: 'theme-color', content: '#fff' },
{
name: "description",
name: 'description',
content:
"Citiasia Center for Smart Nation (CCSN) merupakan salah satu sayap strategis dari Citiasia Inc. dalam menyebarkan semangat membangun bangsa menuju Indonesia Smart Nation",
'Citiasia Center for Smart Nation (CCSN) merupakan salah satu sayap strategis dari Citiasia Inc. dalam menyebarkan semangat membangun bangsa menuju Indonesia Smart Nation',
},
{ name: "keywords", content: "Sarana Berita Smart City Terkini" },
{ name: "author", content: "Smart Nation" },
{ name: 'keywords', content: 'Sarana Berita Smart City Terkini' },
{ name: 'author', content: 'Smart Nation' },
],
// titleTemplate: "%s - Smart Nation",
titleTemplate: (titleChunk) => {
return titleChunk ? `${titleChunk} - Site Title` : "Site Title";
return titleChunk ? `${titleChunk} - Site Title` : 'Site Title';
},
link: [
{
rel: "icon",
type: "image/x-icon",
href: "/logo-smartnation-id-03.png",
rel: 'icon',
type: 'image/x-icon',
href: '/logo-smartnation-id-03.png',
},

// CDN https://fonts.google.com
{ rel: "preconnect", href: "https://fonts.googleapis.com" },
{ rel: 'preconnect', href: 'https://fonts.googleapis.com' },
{
rel: "preconnect",
href: "https://fonts.gstatic.com",
crossorigin: "anonymous",
rel: 'preconnect',
href: 'https://fonts.gstatic.com',
crossorigin: 'anonymous',
},
{
rel: "stylesheet",
href: "https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,500;0,600;1,400;1,500;1,600&family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap",
rel: 'stylesheet',
href: 'https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,500;0,600;1,400;1,500;1,600&family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap',
},

{
rel: "stylesheet",
href: "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css",
rel: 'stylesheet',
href: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css',
},
],

script: [
{
src: "https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js",
src: 'https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js',
integrity:
"sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r",
crossorigin: "anonymous",
async: "true",
'sha384-I7E8VVD/ismYTF4hNIPjVp/Zjvgyol6VFvRkX/vR+Vc4jQkC+hVqc2pM8ODewa9r',
crossorigin: 'anonymous',
async: 'true',
},
],
},
Expand All @@ -132,67 +132,67 @@ export default defineNuxtConfig({
image: {
inject: true,
quality: 75,
format: ["webp", "png"],
domains: ["https://smartnation.id"],
format: ['webp', 'png'],
domains: ['https://smartnation.id'],
},

// Nuxt.js Color Mode configuration
colorMode: {
preference: "light", // default value of $colorMode.preference
fallback: "light", // fallback value if not system preference found
hid: "nuxt-color-mode-script",
globalName: "__NUXT_CCSN_COLOR_MODE__",
componentName: "ColorScheme",
classPrefix: "",
classSuffix: "-mode",
storageKey: "nuxt-ccsn-color-mode",
preference: 'light', // default value of $colorMode.preference
fallback: 'light', // fallback value if not system preference found
hid: 'nuxt-color-mode-script',
globalName: '__NUXT_CCSN_COLOR_MODE__',
componentName: 'ColorScheme',
classPrefix: '',
classSuffix: '-mode',
storageKey: 'nuxt-ccsn-color-mode',
},

pwa: {
registerType: "autoUpdate",
registerType: 'autoUpdate',
manifest: {
name: "Smart Nation",
short_name: "Smart Nation",
name: 'Smart Nation',
short_name: 'Smart Nation',
description:
"Citiasia Center for Smart Nation (CCSN) merupakan salah satu sayap strategis dari Citiasia Inc. dalam menyebarkan semangat membangun bangsa menuju Indonesia Smart Nation",
display: "standalone",
start_url: "/",
background_color: "#fff",
theme_color: "#fff",
'Citiasia Center for Smart Nation (CCSN) merupakan salah satu sayap strategis dari Citiasia Inc. dalam menyebarkan semangat membangun bangsa menuju Indonesia Smart Nation',
display: 'standalone',
start_url: '/',
background_color: '#fff',
theme_color: '#fff',
icons: [
{
src: "/logo-smartnation-id_64x64.png",
sizes: "64x64",
type: "image/png",
src: '/logo-smartnation-id_64x64.png',
sizes: '64x64',
type: 'image/png',
},
{
src: "/logo-smartnation-id_192x192.png",
sizes: "192x192",
type: "image/png",
src: '/logo-smartnation-id_192x192.png',
sizes: '192x192',
type: 'image/png',
},
{
src: "/logo-smartnation-id_512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "any",
src: '/logo-smartnation-id_512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any',
},
{
src: "/logo-smartnation-id_512x512.png",
sizes: "512x512",
type: "image/png",
purpose: "maskable",
src: '/logo-smartnation-id_512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable',
},
],
},
workbox: {
navigateFallback: "/",
globPatterns: ["**/*.{js,css,html,png,svg,ico}"],
navigateFallback: '/',
globPatterns: ['**/*.{js,css,html,png,svg,ico}'],
runtimeCaching: [
{
urlPattern: /^https:\/\/fonts\.googleapis\.com\/.*/i,
handler: "CacheFirst",
handler: 'CacheFirst',
options: {
cacheName: "google-fonts-cache",
cacheName: 'google-fonts-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
Expand All @@ -204,9 +204,9 @@ export default defineNuxtConfig({
},
{
urlPattern: /^https:\/\/fonts\.gstatic\.com\/.*/i,
handler: "CacheFirst",
handler: 'CacheFirst',
options: {
cacheName: "gstatic-fonts-cache",
cacheName: 'gstatic-fonts-cache',
expiration: {
maxEntries: 10,
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
Expand All @@ -228,17 +228,17 @@ export default defineNuxtConfig({
enabled: true,
suppressWarnings: true,
navigateFallbackAllowlist: [/^\/$/],
type: "module",
type: 'module',
},
},

robots: {
/* module options */
rules: [
{ UserAgent: "*" },
{ Disallow: "/" },
{ UserAgent: '*' },
{ Disallow: '/' },
{ BlankLine: true },
{ Comment: "Comment here" },
{ Comment: 'Comment here' },
// Be aware that this will NOT work on target: 'static' mode
{ Sitemap: (req: any) => `https://${req.headers.host}/sitemap.xml` },
],
Expand Down
6 changes: 3 additions & 3 deletions pages/about-us.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import Swal from 'sweetalert2';
// Set Meta SEO
useSeoMeta({
title: "Tentang Kami",
ogTitle: "Tentang Kami",
description: "Citiasia Center for Smart Nation (CCSN)",
title: "Citiasia Center for Smart Nation (CCSN)",
ogTitle: "Citiasia Center for Smart Nation (CCSN)",
description: "Citiasia Center for Smart Nation (CCSN) merupakan salah satu sayap strategis dari Citiasia Inc. dalam menyebarkan semangat membangun bangsa menuju Indonesia Smart Nation",
});
const colorMode = useColorMode();
Expand Down
8 changes: 5 additions & 3 deletions pages/articles/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import { posts } from '~/utils/data/getInitialPostsData';
// Set Meta SEO
useSeoMeta({
title: "Berita",
title: "Daftar Berita",
description: "Citiasia Center for Smart Nation (CCSN) merupakan salah satu sayap strategis dari Citiasia Inc. dalam menyebarkan semangat membangun bangsa menuju Indonesia Smart Nation",
ogTitle: "Daftar berita dari semua kategori",
ogTitle: "Daftar Berita",
ogDescription: "Citiasia Center for Smart Nation (CCSN) merupakan salah satu sayap strategis dari Citiasia Inc. dalam menyebarkan semangat membangun bangsa menuju Indonesia Smart Nation",
});
Expand Down Expand Up @@ -58,7 +58,7 @@ useSeoMeta({
</div>
</div>
</article>
<article v-if="categories" v-for="category in categories" :key="category.id"
<article v-for="category in categories" :key="category.id"
class="article-section position-relative mb-3 py-5">
<div class="d-flex flex-wrap justify-content-between g-0">
<div>
Expand Down Expand Up @@ -116,9 +116,11 @@ useSeoMeta({
/* 24px */
text-align: start;
}
.text-decoration-underline {
margin-bottom: 25px !important;
}
.line-break {
position: relative;
top: -5px;
Expand Down
4 changes: 2 additions & 2 deletions pages/events/category/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const handleClickButton = (values: any) => {
categoryDescription.value = category.description
useSeoMeta({
title: `Berita Kategori ${categoryTitle.value}`,
title: `Kumpulan Acara ${categoryTitle.value}`,
description: categoryDescription.value,
});
Expand All @@ -84,7 +84,7 @@ const popularEventsData = posts.filter(post => post.categories.find(category =>
.slice(0, 10)
useSeoMeta({
title: `Berita Kategori ${categoryTitle.value}`,
title: `Kumpulan Acara ${categoryTitle.value}`,
description: categoryDescription.value,
});
Expand Down

0 comments on commit 270bab1

Please sign in to comment.